[web-app] http拦截器修改,新增监控页面编码
This commit is contained in:
29
web-app/src/app/service/local-storage.service.ts
Normal file
29
web-app/src/app/service/local-storage.service.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
const Authorization = 'Authorization';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class LocalStorageService {
|
||||
|
||||
constructor() { }
|
||||
|
||||
public putData(key: string, value: string) {
|
||||
localStorage.setItem(key, value);
|
||||
}
|
||||
|
||||
public getData(key: string): string | null {
|
||||
const data = localStorage.getItem(key);
|
||||
return data === null ? null : data;
|
||||
}
|
||||
|
||||
public getAuthorizationToken(): string | null {
|
||||
return this.getData(Authorization);
|
||||
}
|
||||
|
||||
public storageAuthorizationToken(token: string) {
|
||||
return this.putData(Authorization, token);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user