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