mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 15:53:02 +10:00
saving ux minus refactor
This commit is contained in:
@ -2,18 +2,22 @@ import toast from "react-hot-toast";
|
||||
|
||||
export const updateUser = async (user: any) => {
|
||||
if (!user) return;
|
||||
toast.promise(
|
||||
fetch("/api/users", {
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(user),
|
||||
}),
|
||||
{
|
||||
loading: "Saving Changes...",
|
||||
success: `Saved!`,
|
||||
error: "Changes could not save user :/",
|
||||
}
|
||||
);
|
||||
toast
|
||||
.promise(
|
||||
fetch("/api/users", {
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(user),
|
||||
}),
|
||||
{
|
||||
loading: "Saving Changes...",
|
||||
success: `Saved!`,
|
||||
error: "Changes could not save user :/",
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
// location.reload();
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user