Skip to content

Commit

Permalink
improve error login in register
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben0189 committed Nov 8, 2024
1 parent eb0989b commit 1d219fb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion blotztask-ui/src/app/signup/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const SignUpPage = () => {

const handleError = (error: unknown) => {
if (error instanceof BadRequestError) {
setError(error.details ? Object.values(error.details).flat().join(' ') : error.message);
setError(error.details ? Object.values(error.details.errors).flat().join(' ') : error.message);
} else {
console.error('Unexpected error during registration:', error);
setError("An unexpected error occurred. Please try again later.");
Expand Down
2 changes: 1 addition & 1 deletion blotztask-ui/src/utils/http-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function fetchWithErrorHandling<T>(
const json = await response.json();

if (response.status === 400) {
throw new BadRequestError(json.errors.title || "Bad Request", json || null);
throw new BadRequestError(json.title || "Bad Request", json || null);
}
if (response.status >= 500) {
throw new ServerError(json.errors.title || "Server Error", json || null);
Expand Down

0 comments on commit 1d219fb

Please sign in to comment.