chore: show error messages from request (#1375)

This commit is contained in:
Aaryan Khandelwal 2023-06-23 19:30:32 +05:30 committed by GitHub
parent 428d0dbac9
commit b87e2fff4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 36 deletions

View file

@ -47,20 +47,15 @@ const SignUp: NextPage = () => {
if (response) await mutateUser();
router.push("/");
})
.catch((err) => {
if (err.status === 400)
setToastAlert({
type: "error",
title: "Error!",
message: "An user already exists with this Email ID.",
});
else
setToastAlert({
type: "error",
title: "Error!",
message: "Something went wrong. Please try again later or contact the support team.",
});
});
.catch((err) =>
setToastAlert({
type: "error",
title: "Error!",
message:
err?.error ||
"Something went wrong. Please try again later or contact the support team.",
})
);
};
return (