15 lines
436 B
TypeScript
15 lines
436 B
TypeScript
|
import { Store } from 'vuex';
|
||
|
import { StateInterface } from 'src/store';
|
||
|
|
||
|
export function hasPermission(
|
||
|
permission: string,
|
||
|
store: Store<StateInterface>
|
||
|
) {
|
||
|
return store.state.user.currentPermissions.includes(permission);
|
||
|
}
|
||
|
|
||
|
export function hasPermissions(needed: string[], store: Store<StateInterface>) {
|
||
|
const permissions = store.state.user.currentPermissions;
|
||
|
return needed.every(value => permissions.includes(value));
|
||
|
}
|