From 298cc4ca2a16650d0f7459c96e6494e23a6fc6b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=93=E9=BC=A0?= <71394853+hamster1963@users.noreply.github.com> Date: Mon, 23 Dec 2024 19:18:39 +0800 Subject: [PATCH] fix: incorrect settings page navigate (#72) --- src/hooks/useAuth.tsx | 1 + src/routes/settings.tsx | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/hooks/useAuth.tsx b/src/hooks/useAuth.tsx index 98b8e4f..4ffa543 100644 --- a/src/hooks/useAuth.tsx +++ b/src/hooks/useAuth.tsx @@ -35,6 +35,7 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => { try { await loginRequest(username, password) const user = await getProfile() + user.role = user.role || 0 setProfile(user) navigate("/dashboard") } catch (error: any) { diff --git a/src/routes/settings.tsx b/src/routes/settings.tsx index 59341a6..877a8fe 100644 --- a/src/routes/settings.tsx +++ b/src/routes/settings.tsx @@ -59,10 +59,7 @@ export default function SettingsPage() { const isAdmin = profile?.role === 0 - console.log(isAdmin) - if (!isAdmin) { - console.log("redirect") navigate("/dashboard/settings/waf") }