mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3887] Different local storages for different ADF apps (#4539)
* [ADF-3887] Different local storages for different ADF apps * [ADF-3887] Add documentation * [ADF-3887] Add unit tests and improve code * [ADF-3887] Add unit tests * [ADF-3887] Fix e2e tests * fix test * fix test * Update storage.service.md
This commit is contained in:
committed by
Eugenio Romano
parent
f89bf507f5
commit
dee63e3f3b
@@ -37,7 +37,8 @@ export enum AppConfigValues {
|
||||
LOG_LEVEL = 'logLevel',
|
||||
LOGIN_ROUTE = 'loginRoute',
|
||||
DISABLECSRF = 'disableCSRF',
|
||||
AUTH_WITH_CREDENTIALS = 'auth.withCredentials'
|
||||
AUTH_WITH_CREDENTIALS = 'auth.withCredentials',
|
||||
APPLICATION = 'application'
|
||||
}
|
||||
|
||||
export enum Status {
|
||||
|
@@ -17,21 +17,26 @@
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { StorageService } from '../services/storage.service';
|
||||
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
|
||||
|
||||
@Injectable()
|
||||
export class DebugAppConfigService extends AppConfigService {
|
||||
constructor(private storage: StorageService, http: HttpClient) {
|
||||
constructor(http: HttpClient) {
|
||||
super(http);
|
||||
}
|
||||
|
||||
/** @override */
|
||||
get<T>(key: string, defaultValue?: T): T {
|
||||
if (key === AppConfigValues.OAUTHCONFIG) {
|
||||
return <T> (JSON.parse(this.storage.getItem(key)) || super.get<T>(key, defaultValue));
|
||||
return <T> (JSON.parse(this.getItem(key)) || super.get<T>(key, defaultValue));
|
||||
} else if (key === AppConfigValues.APPLICATION) {
|
||||
return undefined;
|
||||
} else {
|
||||
return <T> (<any> this.storage.getItem(key) || super.get<T>(key, defaultValue));
|
||||
return <T> (<any> this.getItem(key) || super.get<T>(key, defaultValue));
|
||||
}
|
||||
}
|
||||
|
||||
getItem(key: string): string | null {
|
||||
return localStorage.getItem(key);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user