From a23753f65272dca3f0b54bed16d96512a3cbe20d Mon Sep 17 00:00:00 2001 From: schererleander Date: Fri, 26 Dec 2025 18:08:25 +0100 Subject: refactor(settings): split settings page into separate form components --- src/app/settings/profile-form.tsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/app/settings/profile-form.tsx') diff --git a/src/app/settings/profile-form.tsx b/src/app/settings/profile-form.tsx index 6f532f0..2cd8b52 100644 --- a/src/app/settings/profile-form.tsx +++ b/src/app/settings/profile-form.tsx @@ -4,8 +4,8 @@ import { useState } from "react" import { zodResolver } from "@hookform/resolvers/zod" import { useForm } from "react-hook-form" import { Loader2, User, Save } from "lucide-react" -import { toast } from "sonner" import { Session } from "next-auth" +import { toast } from "sonner" import { Button } from "@/components/ui/button" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" @@ -22,8 +22,6 @@ interface ProfileFormProps { } export function ProfileForm({ user, update }: ProfileFormProps) { - const [isLoading, setIsLoading] = useState(false) - const form = useForm({ resolver: zodResolver(updateProfileSchema), defaultValues: { @@ -33,8 +31,6 @@ export function ProfileForm({ user, update }: ProfileFormProps) { }) const onSubmit = async (data: UpdateProfileInput) => { - setIsLoading(true) - try { const response = await fetch("/api/user/profile", { method: "PATCH", @@ -57,8 +53,6 @@ export function ProfileForm({ user, update }: ProfileFormProps) { toast.success("Profile updated successfully!") } catch { toast.error("An unexpected error occurred") - } finally { - setIsLoading(false) } } @@ -102,8 +96,8 @@ export function ProfileForm({ user, update }: ProfileFormProps) { )} /> - -- cgit v1.3.1