0
0
Fork 0
salix-front-mindshore-fork2/src/composables/useRole.js

21 lines
436 B
JavaScript
Raw Normal View History

import { ComputedRef } from 'vue';
import { useState } from './useState';
2022-03-11 10:41:23 +00:00
export function useRole() {
function hasAny(roles: string[]): boolean {
const { getRoles } = useState();
const roleStore: ComputedRef<string[]> = getRoles();
2022-03-11 10:41:23 +00:00
for (const role of roles) {
if (roleStore.value.indexOf(role) !== -1) return true;
2022-03-11 10:41:23 +00:00
}
return false;
}
return {
hasAny,
};
}