feat: 统一管理端导航为后端下发菜单,移除本地权限过滤

This commit is contained in:
2026-05-19 09:34:52 +08:00
parent 1b1dfc92ab
commit d625c59393
8 changed files with 57 additions and 179 deletions

View File

@@ -1,4 +1,5 @@
import type { AdminProfile } from "@/types/api/admin-auth";
import type { AdminNavItem } from "@/modules/_config/admin-nav";
const KEY = "lottery_admin_profile";
@@ -20,12 +21,24 @@ export function readProfile(): AdminProfile | null {
const permissions = Array.isArray(v.permissions)
? v.permissions.filter((s): s is string => typeof s === "string")
: [];
const navigation = Array.isArray(v.navigation)
? v.navigation.filter((item): item is AdminNavItem => {
return (
item !== null &&
typeof item === "object" &&
typeof item.segment === "string" &&
typeof item.label === "string" &&
typeof item.href === "string"
);
})
: [];
return {
id: v.id,
username: v.username,
nickname: v.nickname,
email: typeof v.email === "string" || v.email === null ? v.email : null,
permissions,
navigation,
};
}
} catch {