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 | 34x 34x 34x 36x 34x 17x 17x 17x 15x 15x 1x 1x 1x 14x 5x 1x 1x 1x | import { Injectable } from '@angular/core';
import { SessionInformation } from '@core/model/session-information.interface';
import { BehaviorSubject } from 'rxjs';
import { DataStorageService } from './data-storage.service';
const SESSION_INFO_KEY = 'session-info';
@Injectable({
providedIn: 'root'
})
export class SessionStorageService {
private sessionInfo: SessionInformation|null = null;
private readonly sessionInfoSubject = new BehaviorSubject<SessionInformation|null>(null);
constructor(private readonly dataStorageService: DataStorageService) {
this.sessionInfo = this.dataStorageService.getItem<SessionInformation>(SESSION_INFO_KEY);
this.sessionInfoSubject.next(this.sessionInfo);
}
public clearSessionInformation() :void {
this.dataStorageService.removeItem(SESSION_INFO_KEY);
this.sessionInfo = null;
this.sessionInfoSubject.next(null);
}
public getSessionInformation() :SessionInformation | null {
return this.sessionInfo;
}
public $getSessionInformation(): BehaviorSubject<SessionInformation|null> {
return this.sessionInfoSubject;
}
public saveSessionInformation(data : SessionInformation) :void {
this.sessionInfo = data;
this.dataStorageService.setItem(SESSION_INFO_KEY, data);
this.sessionInfoSubject.next(this.sessionInfo);
}
} |