ui, ui button component fix

This commit is contained in:
Timur Ercan
2023-02-09 19:58:24 +01:00
parent 88baee6fc2
commit df047bc749
2 changed files with 15 additions and 18 deletions

View File

@@ -2,22 +2,18 @@ import toast from "react-hot-toast";
export const updateUser = async (user: any) => { export const updateUser = async (user: any) => {
if (!user) return; if (!user) return;
toast toast.promise(
.promise( fetch("/api/users", {
fetch("/api/users", { method: "PATCH",
method: "PATCH", headers: {
headers: { "Content-Type": "application/json",
"Content-Type": "application/json", },
}, body: JSON.stringify(user),
body: JSON.stringify(user), }),
}), {
{ loading: "Saving Changes...",
loading: "Saving Changes...", success: `Saved!`,
success: `Saved!`, error: "Changes could not save user :/",
error: "Changes could not save user :/", }
} );
)
.then(() => {
// location.reload();
});
}; };

View File

@@ -35,6 +35,7 @@ export function Button(props: any) {
) : ( ) : (
<button <button
id={props.id} id={props.id}
type="button"
className={classNames( className={classNames(
baseStyles, baseStyles,
color === "primary" ? primaryStyles : secondaryStyles, color === "primary" ? primaryStyles : secondaryStyles,