From 312061330cc107cc2b089b0e120c00ad4826cbf3 Mon Sep 17 00:00:00 2001 From: zetaloop Date: Sun, 22 Feb 2026 08:03:09 +0800 Subject: [PATCH] refactor(auth): unify current user state usage across UI --- app/(account)/settings/page.tsx | 13 +++++------ app/(auth)/login/page.tsx | 4 ++-- app/(auth)/register/page.tsx | 4 ++-- app/(order)/chat/[id]/page.tsx | 12 +++++----- app/(order)/orders/page.tsx | 6 ++--- components/header.tsx | 40 +++++++++++++++++++-------------- components/login-dialog.tsx | 4 ++-- components/post-comments.tsx | 8 +++---- 8 files changed, 47 insertions(+), 44 deletions(-) diff --git a/app/(account)/settings/page.tsx b/app/(account)/settings/page.tsx index 0c22a45..7d02fa6 100644 --- a/app/(account)/settings/page.tsx +++ b/app/(account)/settings/page.tsx @@ -11,12 +11,11 @@ import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group" import { Separator } from "@/components/ui/separator" import { Switch } from "@/components/ui/switch" import { Textarea } from "@/components/ui/textarea" -import { currentUser } from "@/lib/mock" import type { UserRole } from "@/lib/types" import { useAuthStore } from "@/store/auth" export default function SettingsPage() { - const { currentRole, verifiedRoles, switchRole } = useAuthStore() + const { currentRole, verifiedRoles, switchRole, user } = useAuthStore() const isRoleVerified = (role: UserRole) => verifiedRoles.includes(role) @@ -31,8 +30,8 @@ export default function SettingsPage() {
- - {currentUser.nickname[0]} + + {user?.nickname?.[0] ?? "?"}