Skip to content

Commit

Permalink
fix: incorrect settings page navigate (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
hamster1963 authored Dec 23, 2024
1 parent 5e3db19 commit b9cee05
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 1 addition & 0 deletions src/hooks/useAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 0 additions & 3 deletions src/routes/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down

0 comments on commit b9cee05

Please sign in to comment.