mixin role and config url

This commit is contained in:
saeid_01
2019-04-24 10:43:43 +04:30
parent d23c5f134b
commit df660dd7d4
24 changed files with 3430 additions and 3360 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ const TokenService = {
},
saveInfo(info = null) {
info = qs.stringify(info);
info = qs.stringify(info);
localStorage.setItem(INFO, info)
},
+16
View File
@@ -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;
}
},
}