mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4457] StorageService should be independent of AppConfigService (#4712)
* [ADF-4457] StorageService should be independent of AppConfigService * [ADF-4457] Fix e2e tests * [ADF-4457] Fix e2e tests * [ADF-4457] Improve storage service workflow * Fix linting * Fix unit tests * Fix e2e test * Add missing class to constructor * Fix e2e test * Rebase branch * Improve unit test * fix test
This commit is contained in:
committed by
Eugenio Romano
parent
90c403ae9e
commit
5c07d5b3e6
@@ -17,26 +17,23 @@
|
||||
|
||||
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(http: HttpClient) {
|
||||
constructor(private storage: StorageService, http: HttpClient) {
|
||||
super(http);
|
||||
}
|
||||
|
||||
/** @override */
|
||||
get<T>(key: string, defaultValue?: T): T {
|
||||
if (key === AppConfigValues.OAUTHCONFIG) {
|
||||
return <T> (JSON.parse(this.getItem(key)) || super.get<T>(key, defaultValue));
|
||||
return <T> (JSON.parse(this.storage.getItem(key)) || super.get<T>(key, defaultValue));
|
||||
} else if (key === AppConfigValues.APPLICATION) {
|
||||
return undefined;
|
||||
} else {
|
||||
return <T> (<any> this.getItem(key) || super.get<T>(key, defaultValue));
|
||||
return <T> (<any> this.storage.getItem(key) || super.get<T>(key, defaultValue));
|
||||
}
|
||||
}
|
||||
|
||||
getItem(key: string): string | null {
|
||||
return localStorage.getItem(key);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user