mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-13 10:51:04 +03:30
mixin role and config url
This commit is contained in:
+1
-1
@@ -39,7 +39,7 @@ const TokenService = {
|
||||
},
|
||||
|
||||
saveInfo(info = null) {
|
||||
info = qs.stringify(info);
|
||||
info = qs.stringify(info);
|
||||
localStorage.setItem(INFO, info)
|
||||
},
|
||||
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { TokenService } from '@/services'
|
||||
export default {
|
||||
methods: {
|
||||
$hasRole(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user