forked from hazza/dspace-angular
fixed auth module
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { BrowserModule, makeStateKey, TransferState } from '@angular/platform-browser';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { REQUEST } from '@nguniversal/express-engine/tokens';
|
||||
|
||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
||||
@@ -15,10 +16,16 @@ import { AppModule } from '../../app/app.module';
|
||||
import { DSpaceBrowserTransferStateModule } from '../transfer-state/dspace-browser-transfer-state.module';
|
||||
import { DSpaceTransferState } from '../transfer-state/dspace-transfer-state.service';
|
||||
|
||||
export const REQ_KEY = makeStateKey<string>('req');
|
||||
|
||||
export function createTranslateLoader(http: HttpClient) {
|
||||
return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
|
||||
}
|
||||
|
||||
export function getRequest(transferState: TransferState): any {
|
||||
return transferState.get<any>(REQ_KEY, {})
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
bootstrap: [AppComponent],
|
||||
imports: [
|
||||
@@ -45,6 +52,13 @@ export function createTranslateLoader(http: HttpClient) {
|
||||
}),
|
||||
AppModule
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: REQUEST,
|
||||
useFactory: getRequest,
|
||||
deps: [TransferState]
|
||||
}
|
||||
]
|
||||
})
|
||||
export class BrowserAppModule {
|
||||
constructor(
|
||||
|
Reference in New Issue
Block a user