fes.js/packages/fes-plugin-access/types.d.ts
2023-02-21 20:05:25 +08:00

30 lines
870 B
TypeScript

import { Router, NavigationGuard } from 'vue-router';
import { Ref } from 'vue';
export const access: {
hasAccess(accessId: string | number): Promise<boolean>;
isDataReady(): boolean;
setRole(roleId: string | Promise<string>): void;
setAccess(accessIds: Array<string | number> | Promise<Array<string | number>>): void;
getAccess(): string[];
};
export function useAccess(accessId: Array<string | number>): Ref<boolean>;
declare module '@fesjs/fes' {
interface PluginBuildConfig {
access?:
| {
rules: Record<string, []>;
}
| false;
}
interface PluginRuntimeConfig {
access?: {
noFoundHandler: (param: { router: Router } & NavigationGuard) => void;
unAccessHandler: (param: { router: Router } & NavigationGuard) => void;
};
}
}