[ADF-1070] fix issue with user preferences and page reload (#2075)

* user preferences profile storage support

* update unit test
This commit is contained in:
Denys Vuika
2017-07-12 10:25:02 +01:00
committed by Eugenio Romano
parent 52ef483216
commit 0262b3426e
2 changed files with 3 additions and 4 deletions

View File

@@ -61,6 +61,7 @@ describe('UserPreferencesService', () => {
});
it('should format property key for default prefix', () => {
preferences.setStoragePrefix(null);
expect(preferences.getPropertyKey('propertyA')).toBe('GUEST__propertyA');
});

View File

@@ -26,14 +26,12 @@ export class UserPreferencesService {
paginationSize: 25
};
private _storagePrefix: string = 'GUEST';
getStoragePrefix(): string {
return this._storagePrefix;
return this.storage.getItem('USER_PROFILE') || 'GUEST';
}
setStoragePrefix(value: string) {
this._storagePrefix = value || 'GUEST';
this.storage.setItem('USER_PROFILE', value || 'GUEST');
}
constructor(