Files
policy-ui/app/composables/useSuperAdmin.ts
Jordan Weingarten 67482f6629 WIP jordan
2026-04-16 11:11:44 -05:00

22 lines
615 B
TypeScript

/**
* Tenant-level admin (company logo, legal name, etc.).
* Wire to real roles/claims when auth exists. Until then:
* - localStorage `policy-ui.superadmin` = `1` | `0`
* - in dev, defaults to true when the key is unset so the org screen is reachable
*/
export function useSuperAdmin() {
const isSuperAdmin = computed(() => {
if (!import.meta.client) return false
try {
const v = localStorage.getItem('policy-ui.superadmin')
if (v === '1') return true
if (v === '0') return false
return import.meta.dev
} catch {
return false
}
})
return { isSuperAdmin }
}