Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 99x 99x 99x 99x 10x 10x 10x 99x 4x 4x 99x 99x 10x 99x 1x 99x 424x 99x | import { Injectable } from '@angular/core'; import { Permissions } from '../models/permissions'; @Injectable({ providedIn: 'root' }) export class AuthStorageService { constructor() {} set(username: string, token: string, permissions: object = {}) { localStorage.setItem('dashboard_username', username); localStorage.setItem('access_token', token); localStorage.setItem('dashboard_permissions', JSON.stringify(new Permissions(permissions))); } remove() { localStorage.removeItem('access_token'); localStorage.removeItem('dashboard_username'); } getToken(): string { return localStorage.getItem('access_token'); } isLoggedIn() { return localStorage.getItem('dashboard_username') !== null; } getUsername() { return localStorage.getItem('dashboard_username'); } getPermissions(): Permissions { return JSON.parse( localStorage.getItem('dashboard_permissions') || JSON.stringify(new Permissions({})) ); } } |