Browse Source
Merge pull request #6626 from abpframework/fix/6625
Fixed the state updating problem in SessionStateService
pull/6644/head
Bunyamin Coskuner
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
4 additions and
6 deletions
-
npm/ng-packs/packages/core/src/lib/services/replaceable-components.service.ts
-
npm/ng-packs/packages/core/src/lib/services/session-state.service.ts
-
npm/ng-packs/packages/core/src/lib/utils/initial-utils.ts
-
npm/ng-packs/packages/core/src/lib/utils/internal-store-utils.ts
|
|
|
@ -39,7 +39,7 @@ export class ReplaceableComponentsService { |
|
|
|
replaceableComponents.push(replaceableComponent); |
|
|
|
} |
|
|
|
|
|
|
|
this.store.patch(replaceableComponents); |
|
|
|
this.store.set(replaceableComponents); |
|
|
|
|
|
|
|
if (reload) reloadRoute(this.router, this.ngZone); |
|
|
|
} |
|
|
|
|
|
|
|
@ -30,7 +30,7 @@ export class SessionStateService { |
|
|
|
private init() { |
|
|
|
const session = localStorage.getItem('abpSession'); |
|
|
|
if (session) { |
|
|
|
this.store.patch(JSON.parse(session)); |
|
|
|
this.store.set(JSON.parse(session)); |
|
|
|
} |
|
|
|
|
|
|
|
this.store.sliceUpdate(state => state).subscribe(this.updateLocalStorage); |
|
|
|
@ -81,7 +81,7 @@ export class SessionStateService { |
|
|
|
setTenant(tenant: CurrentTenantDto) { |
|
|
|
if (compare(tenant, this.store.state.tenant)) return; |
|
|
|
|
|
|
|
this.store.patch({ tenant }); |
|
|
|
this.store.set({ ...this.store.state, tenant }); |
|
|
|
} |
|
|
|
|
|
|
|
setLanguage(language: string) { |
|
|
|
|
|
|
|
@ -38,8 +38,6 @@ export function getInitialData(injector: Injector) { |
|
|
|
tap(() => checkAccessToken(injector)), |
|
|
|
tap(() => { |
|
|
|
const currentTenant = configState.getOne('currentTenant') as CurrentTenantDto; |
|
|
|
if (!currentTenant?.id) return; |
|
|
|
|
|
|
|
injector.get(SessionStateService).setTenant(currentTenant); |
|
|
|
}), |
|
|
|
) |
|
|
|
|
|
|
|
@ -36,6 +36,6 @@ export class InternalStore<State> { |
|
|
|
} |
|
|
|
|
|
|
|
reset() { |
|
|
|
this.patch(this.initialState); |
|
|
|
this.set(this.initialState); |
|
|
|
} |
|
|
|
} |
|
|
|
|