Masum ULU
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
5 additions and
3 deletions
-
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 { filter, take } from 'rxjs/operators'; |
|
|
|
import { Session } from '../models/session'; |
|
|
|
@ -12,6 +13,7 @@ import { AbpLocalStorageService } from './local-storage.service'; |
|
|
|
}) |
|
|
|
export class SessionStateService { |
|
|
|
private readonly store = new InternalStore({} as Session.State); |
|
|
|
protected readonly document = inject(DOCUMENT); |
|
|
|
|
|
|
|
private updateLocalStorage = () => { |
|
|
|
this.localStorageService.setItem('abpSession', JSON.stringify(this.store.state)); |
|
|
|
@ -89,9 +91,9 @@ export class SessionStateService { |
|
|
|
this.store.patch({ language }); |
|
|
|
} |
|
|
|
|
|
|
|
const currentAttribute = document.documentElement.getAttribute('lang'); |
|
|
|
const currentAttribute = this.document.documentElement.getAttribute('lang'); |
|
|
|
if (language !== currentAttribute) { |
|
|
|
document.documentElement.setAttribute('lang', language); |
|
|
|
this.document.documentElement.setAttribute('lang', language); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|