22 lines
593 B
TypeScript
22 lines
593 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { SessionStorageService } from 'ngx-webstorage';
|
|
|
|
@Injectable({ providedIn: 'root' })
|
|
export class StateStorageService {
|
|
private previousUrlKey = 'previousUrl';
|
|
|
|
constructor(private sessionStorageService: SessionStorageService) {}
|
|
|
|
storeUrl(url: string): void {
|
|
this.sessionStorageService.store(this.previousUrlKey, url);
|
|
}
|
|
|
|
getUrl(): string | null {
|
|
return this.sessionStorageService.retrieve(this.previousUrlKey) as string | null;
|
|
}
|
|
|
|
clearUrl(): void {
|
|
this.sessionStorageService.clear(this.previousUrlKey);
|
|
}
|
|
}
|