feat: images upload

This commit is contained in:
Ivan Rezchikov
2026-07-04 15:45:05 +03:00
parent 2eb0de5357
commit e192717466
38 changed files with 1334 additions and 615 deletions
+3 -19
View File
@@ -1,29 +1,13 @@
"use client";
import { useTransition } from "react";
import { useAction } from "@/hooks/useAction";
import { Button } from "@/components/ui/button";
import { Spinner } from "@/components/ui/spinner";
import { toast } from "sonner";
import { updateUserAction } from "@/lib/user/actions";
export function UpdateButton() {
const [isPending, startTransition] = useTransition();
const { run, isPending } = useAction(updateUserAction, { successMessage: "Profile updated" });
return (
<Button
variant="secondary"
disabled={isPending}
onClick={() =>
startTransition(async () => {
try {
await updateUserAction();
toast.success("Profile updated");
} catch {
toast.error("Failed to update profile. Your session may have expired. Try signing in again.");
}
})
}
>
<Button variant="secondary" disabled={isPending} onClick={() => run()}>
{isPending && <Spinner />}Update
</Button>
);