93219: Fold DSpaceTransferState into InitService

This commit is contained in:
Yura Bondarenko
2022-07-22 13:31:46 +02:00
parent bdc004f64d
commit 5ff80a8a02
11 changed files with 48 additions and 117 deletions

View File

@@ -8,9 +8,8 @@
import { select, Store } from '@ngrx/store';
import { CheckAuthenticationTokenAction } from './core/auth/auth.actions';
import { CorrelationIdService } from './correlation-id/correlation-id.service';
import { DSpaceTransferState } from '../modules/transfer-state/dspace-transfer-state.service';
import { APP_INITIALIZER, Inject, Optional, Provider, Type } from '@angular/core';
import { TransferState } from '@angular/platform-browser';
import { makeStateKey, TransferState } from '@angular/platform-browser';
import { APP_CONFIG, AppConfig } from '../config/app-config.interface';
import { environment } from '../environments/environment';
import { AppState } from './app.reducer';
@@ -38,10 +37,15 @@ import { ThemeService } from './shared/theme-support/theme.service';
* For example, NgbModal depends on ApplicationRef and can therefore not be used during initialization.
*/
export abstract class InitService {
/**
* The state transfer key to use for the NgRx store state
* @protected
*/
protected static NGRX_STATE = makeStateKey('NGRX_STATE');
protected constructor(
protected store: Store<AppState>,
protected correlationIdService: CorrelationIdService,
protected dspaceTransferState: DSpaceTransferState,
@Inject(APP_CONFIG) protected appConfig: AppConfig,
protected translate: TranslateService,
protected localeService: LocaleService,
@@ -130,14 +134,6 @@ export abstract class InitService {
this.correlationIdService.initCorrelationId();
}
/**
* Transfer the application's NgRx state between server-side and client-side
* @protected
*/
protected async transferAppState(): Promise<unknown> {
return this.dspaceTransferState.transfer();
}
/**
* Make sure the {@link environment} matches {@link APP_CONFIG} and print
* some information about it to the console