mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
toast fix
This commit is contained in:
@ -29,39 +29,39 @@ 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
|
||||||
fetch("/api/auth/signup", {
|
.promise(
|
||||||
body: JSON.stringify({
|
fetch("/api/auth/signup", {
|
||||||
...data,
|
body: JSON.stringify({
|
||||||
}),
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
method: "POST",
|
|
||||||
})
|
|
||||||
.then(handleErrors)
|
|
||||||
.then(async () => {
|
|
||||||
await signIn<"credentials">("credentials", {
|
|
||||||
...data,
|
...data,
|
||||||
callbackUrl: "https://app.documenso.com/dashboard",
|
}),
|
||||||
});
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
method: "POST",
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.then(handleErrors)
|
||||||
methods.setError("apiError", { message: err.message });
|
.then(async () => {
|
||||||
// Throw again for toast
|
await signIn<"credentials">("credentials", {
|
||||||
throw new Error(err.message);
|
...data,
|
||||||
}),
|
callbackUrl: "https://app.documenso.com/dashboard",
|
||||||
{
|
});
|
||||||
loading: "Creating your account...",
|
}),
|
||||||
success: "Done!",
|
{
|
||||||
error: (err) => err.message,
|
loading: "Creating your account...",
|
||||||
},
|
success: "Done!",
|
||||||
{
|
error: (err) => err.message,
|
||||||
style: {
|
|
||||||
minWidth: "200px",
|
|
||||||
},
|
},
|
||||||
}
|
{
|
||||||
);
|
style: {
|
||||||
|
minWidth: "200px",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.catch((err) => {
|
||||||
|
toast.dismiss();
|
||||||
|
methods.setError("apiError", { message: err.message });
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function renderApiError() {
|
function renderApiError() {
|
||||||
|
|||||||
Reference in New Issue
Block a user