14 lines
493 B
TypeScript
14 lines
493 B
TypeScript
"use client";
|
|
import { useAction } from "@/hooks/useAction";
|
|
import { Button } from "@/components/ui/button";
|
|
import { Spinner } from "@/components/ui/spinner";
|
|
import { updateUserAction } from "@/lib/user/actions";
|
|
|
|
export function UpdateButton() {
|
|
const { run, isPending } = useAction(updateUserAction, { successMessage: "Profile updated" });
|
|
return (
|
|
<Button variant="secondary" disabled={isPending} onClick={() => run()}>
|
|
{isPending && <Spinner />}Update
|
|
</Button>
|
|
);
|
|
} |