Browse Source

Update session-state.service.ts

pull/20856/head
Masum ULU 2 years ago
committed by GitHub
parent
commit
daa339517e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      npm/ng-packs/packages/core/src/lib/services/session-state.service.ts

8
npm/ng-packs/packages/core/src/lib/services/session-state.service.ts

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable, inject } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import compare from 'just-compare'; import compare from 'just-compare';
import { filter, take } from 'rxjs/operators'; import { filter, take } from 'rxjs/operators';
import { Session } from '../models/session'; import { Session } from '../models/session';
@ -12,6 +13,7 @@ import { AbpLocalStorageService } from './local-storage.service';
}) })
export class SessionStateService { export class SessionStateService {
private readonly store = new InternalStore({} as Session.State); private readonly store = new InternalStore({} as Session.State);
protected readonly document = inject(DOCUMENT);
private updateLocalStorage = () => { private updateLocalStorage = () => {
this.localStorageService.setItem('abpSession', JSON.stringify(this.store.state)); this.localStorageService.setItem('abpSession', JSON.stringify(this.store.state));
@ -89,9 +91,9 @@ export class SessionStateService {
this.store.patch({ language }); this.store.patch({ language });
} }
const currentAttribute = document.documentElement.getAttribute('lang'); const currentAttribute = this.document.documentElement.getAttribute('lang');
if (language !== currentAttribute) { if (language !== currentAttribute) {
document.documentElement.setAttribute('lang', language); this.document.documentElement.setAttribute('lang', language);
} }
} }
} }

Loading…
Cancel
Save