From b25c56f76780dec0236fc14717f4e35842bf7025 Mon Sep 17 00:00:00 2001 From: Afolami Anuoluwapo <161776085+aabxtract@users.noreply.github.com> Date: Sat, 30 May 2026 14:11:37 +0000 Subject: [PATCH] fix --- app/(auth)/verify-otp/page.tsx | 5 +++-- components/profile/profile-edit-form.tsx | 2 ++ components/profile/profile-overview.tsx | 2 ++ hooks/use-auth-store.ts | 4 +++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/(auth)/verify-otp/page.tsx b/app/(auth)/verify-otp/page.tsx index e444159..d9c8e78 100644 --- a/app/(auth)/verify-otp/page.tsx +++ b/app/(auth)/verify-otp/page.tsx @@ -72,8 +72,9 @@ export default function VerifyOtpPage() { setIsLoading(true); setError(''); try { - const res = await verifyLoginOtp({ email: storedEmail, otp: otpCode }) as { user: { id: string; name: string; email: string; role: 'USER' | 'ADMIN' }; accessToken: string; refreshToken: string }; - setAuth(res.user, res.accessToken, res.refreshToken); + const res = await verifyLoginOtp({ email: storedEmail, otp: otpCode }) as { user: { id: string; firstName: string; lastName: string; email: string; role: 'USER' | 'ADMIN' }; accessToken: string; refreshToken: string }; + const fullName = [res.user.firstName, res.user.lastName].filter(Boolean).join(' '); + setAuth({ ...res.user, name: fullName }, res.accessToken, res.refreshToken); setIsLoading(false); router.push('/dashboard'); } catch (err: unknown) { diff --git a/components/profile/profile-edit-form.tsx b/components/profile/profile-edit-form.tsx index 600d8e7..97925c5 100644 --- a/components/profile/profile-edit-form.tsx +++ b/components/profile/profile-edit-form.tsx @@ -48,6 +48,8 @@ export function ProfileEditForm() { setAuth( { id: updated.id, + firstName: updated.firstName, + lastName: updated.lastName, name: `${updated.firstName} ${updated.lastName}`, email: updated.email, role: 'USER', diff --git a/components/profile/profile-overview.tsx b/components/profile/profile-overview.tsx index f1cae3d..48df31f 100644 --- a/components/profile/profile-overview.tsx +++ b/components/profile/profile-overview.tsx @@ -24,6 +24,8 @@ export function ProfileOverview() { setAuth( { id: data.id, + firstName: data.firstName, + lastName: data.lastName, name: `${data.firstName} ${data.lastName}`, email: data.email, role: 'USER', diff --git a/hooks/use-auth-store.ts b/hooks/use-auth-store.ts index 9f41954..62b3d51 100644 --- a/hooks/use-auth-store.ts +++ b/hooks/use-auth-store.ts @@ -13,7 +13,9 @@ export interface UserProfileStore { interface User { id: string; - name: string; + firstName: string; + lastName: string; + name: string; // derived from firstName + lastName email: string; role: "USER" | "ADMIN"; // Optionally add more fields if needed