mirror of
https://github.com/beak-insights/felicity-lims.git
synced 2025-02-22 16:03:00 +08:00
19 lines
470 B
TypeScript
19 lines
470 B
TypeScript
import { useAuthStore } from '@/stores';
|
|
import { IGroup } from '@/models/auth';
|
|
|
|
function canAccessPage(pageName: string) {
|
|
const authStore = useAuthStore();
|
|
|
|
const groups = authStore.auth?.user?.groups;
|
|
|
|
if (!groups || groups?.length == 0) return false;
|
|
|
|
const group = groups![0] as IGroup;
|
|
if (group?.pages) {
|
|
return group?.pages?.toLowerCase()?.includes(pageName?.toLowerCase());
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
export default canAccessPage;
|