mirror of
https://git.meshkee.com/cssd/cssd-front.git
synced 2026-10-11 20:03:25 +03:30
16 lines
412 B
JavaScript
16 lines
412 B
JavaScript
import { TokenService } from '@/services'
|
|
|
|
const $hasRole = function (roles) {
|
|
if (TokenService.getToken()) {
|
|
roles = roles.split('|');
|
|
for (const role of roles) {
|
|
if (TokenService.getInfo().roles && Array.isArray(TokenService.getInfo().roles) && TokenService.getInfo().roles.includes(role)) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
export {
|
|
$hasRole
|
|
} |