update user as feature

This commit is contained in:
Timur Ercan
2023-01-25 12:24:18 +01:00
parent 4d2db89504
commit 30be711dd0

View 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 :/",
}
);
};