mirror of
https://github.com/beak-insights/felicity-lims.git
synced 2025-02-24 08:53:00 +08:00
20 lines
443 B
TypeScript
20 lines
443 B
TypeScript
import { useAuthStore } from "../stores"
|
|
import { IGroup } from "../models/auth";
|
|
|
|
async 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) {
|
|
return group?.pages?.includes(pageName);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
export default canAccessPage;
|