chore(history): import initial web product snapshot

This commit is contained in:
wmq
2026-07-25 00:30:00 +08:00
commit cf0eed46c3
131 changed files with 15693 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
import { useAuthStore } from '@/app/store/auth'
import { ROLE_PERMISSIONS, type Permission, type RoleKey } from '@/config/roles'
export function usePermission() {
const role = useAuthStore((s) => s.user?.role ?? 'viewer') as RoleKey
const perms = ROLE_PERMISSIONS[role] ?? []
return {
role,
can: (p: Permission) => perms.includes(p),
canAny: (...ps: Permission[]) => ps.some((p) => perms.includes(p)),
}
}