mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
update user as feature
This commit is contained in:
19
packages/features/updateUser.ts
Normal file
19
packages/features/updateUser.ts
Normal file
@ -0,0 +1,19 @@
|
||||
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 :/",
|
||||
}
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user