You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
452 B
23 lines
452 B
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);
|
|
}
|
|
}
|