toast fix

This commit is contained in:
Timur Ercan
2023-01-14 18:55:17 +01:00
parent 40475b144f
commit 184b33c9d9

View File

@ -29,7 +29,8 @@ export default function Signup() {
}; };
const signUp: SubmitHandler<FormValues> = async (data) => { const signUp: SubmitHandler<FormValues> = async (data) => {
const res = await toast.promise( const res = await toast
.promise(
fetch("/api/auth/signup", { fetch("/api/auth/signup", {
body: JSON.stringify({ body: JSON.stringify({
...data, ...data,
@ -45,11 +46,6 @@ export default function Signup() {
...data, ...data,
callbackUrl: "https://app.documenso.com/dashboard", callbackUrl: "https://app.documenso.com/dashboard",
}); });
})
.catch((err) => {
methods.setError("apiError", { message: err.message });
// Throw again for toast
throw new Error(err.message);
}), }),
{ {
loading: "Creating your account...", loading: "Creating your account...",
@ -61,7 +57,11 @@ export default function Signup() {
minWidth: "200px", minWidth: "200px",
}, },
} }
); )
.catch((err) => {
toast.dismiss();
methods.setError("apiError", { message: err.message });
});
}; };
function renderApiError() { function renderApiError() {