parent
8598b29bec
commit
3c3a87c4cf
@ -0,0 +1,23 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class LocalStorageService {
|
||||||
|
|
||||||
|
private readonly AUTH_TOKEN_KEY = 'auth_token';
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
setToken(token: string): void {
|
||||||
|
localStorage.setItem(this.AUTH_TOKEN_KEY, token);
|
||||||
|
}
|
||||||
|
|
||||||
|
getToken(): string | null {
|
||||||
|
return localStorage.getItem(this.AUTH_TOKEN_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
removeToken(): void {
|
||||||
|
localStorage.removeItem(this.AUTH_TOKEN_KEY);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue