update preferences service

This commit is contained in:
Dan Percic 2023-08-17 13:49:52 +03:00
parent e553ba3272
commit 625603def6

View File

@ -12,15 +12,15 @@ const KEYS = {
@Injectable()
export abstract class IqserUserPreferenceService extends GenericService<UserAttributes> {
#userAttributes: UserAttributes = {};
protected abstract readonly _devFeaturesEnabledKey: string;
protected readonly _serviceName: string = 'tenant-user-management';
#userAttributes: UserAttributes = {};
get userAttributes(): UserAttributes {
return this.#userAttributes;
}
get areDevFeaturesEnabled(): boolean {
get isIqserDevMode(): boolean {
const value = sessionStorage.getItem(this._devFeaturesEnabledKey);
return value === 'true' ?? false;
}
@ -43,7 +43,7 @@ export abstract class IqserUserPreferenceService extends GenericService<UserAttr
}
toggleDevFeatures(): void {
sessionStorage.setItem(this._devFeaturesEnabledKey, String(!this.areDevFeaturesEnabled));
sessionStorage.setItem(this._devFeaturesEnabledKey, String(!this.isIqserDevMode));
window.location.reload();
}
@ -74,3 +74,7 @@ export class DefaultUserPreferenceService extends IqserUserPreferenceService {
protected readonly _defaultModelPath = 'attributes';
protected readonly _devFeaturesEnabledKey = inject(BASE_HREF) + '.enable-dev-features';
}
export function isIqserDevMode() {
return inject(IqserUserPreferenceService).isIqserDevMode;
}