Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public isAuthenticated(): boolean {
- if (localStorage.getItem('token')){
- return true;
- }
- else {
- return false;
- }
- }
- public isAdmin(): boolean {
- if (!this.isAuthenticated()) {
- return false;
- }
- var userInfo: UserInfo = JSON.parse(localStorage.getItem('userInfo'));
- if (userInfo == null) {
- return false;
- }
- let userRole = userInfo.UserRole;
- if (userRole == 1) {
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement