mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-02-04 12:40:08 +00:00
fix: incorrect settings page navigate (#72)
This commit is contained in:
@@ -35,6 +35,7 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
try {
|
try {
|
||||||
await loginRequest(username, password)
|
await loginRequest(username, password)
|
||||||
const user = await getProfile()
|
const user = await getProfile()
|
||||||
|
user.role = user.role || 0
|
||||||
setProfile(user)
|
setProfile(user)
|
||||||
navigate("/dashboard")
|
navigate("/dashboard")
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|||||||
@@ -59,10 +59,7 @@ export default function SettingsPage() {
|
|||||||
|
|
||||||
const isAdmin = profile?.role === 0
|
const isAdmin = profile?.role === 0
|
||||||
|
|
||||||
console.log(isAdmin)
|
|
||||||
|
|
||||||
if (!isAdmin) {
|
if (!isAdmin) {
|
||||||
console.log("redirect")
|
|
||||||
navigate("/dashboard/settings/waf")
|
navigate("/dashboard/settings/waf")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user