mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
72699: Hard redirect after log in
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { InjectionToken, NgModule } from '@angular/core';
|
||||
import { BrowserModule, makeStateKey, TransferState } from '@angular/platform-browser';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterModule } from '@angular/router';
|
||||
@@ -21,6 +21,8 @@ import { AuthService } from '../../app/core/auth/auth.service';
|
||||
import { Angulartics2RouterlessModule } from 'angulartics2/routerlessmodule';
|
||||
import { SubmissionService } from '../../app/submission/submission.service';
|
||||
import { StatisticsModule } from '../../app/statistics/statistics.module';
|
||||
import { HardRedirectService } from '../../app/core/services/hard-redirect.service';
|
||||
import { BrowserHardRedirectService } from '../../app/core/services/browser-hard-redirect.service';
|
||||
|
||||
export const REQ_KEY = makeStateKey<string>('req');
|
||||
|
||||
@@ -32,6 +34,13 @@ export function getRequest(transferState: TransferState): any {
|
||||
return transferState.get<any>(REQ_KEY, {});
|
||||
}
|
||||
|
||||
export const LocationToken = new InjectionToken('Location');
|
||||
|
||||
export function locationProvider(): Location {
|
||||
return window.location;
|
||||
}
|
||||
|
||||
|
||||
@NgModule({
|
||||
bootstrap: [AppComponent],
|
||||
imports: [
|
||||
@@ -78,7 +87,15 @@ export function getRequest(transferState: TransferState): any {
|
||||
{
|
||||
provide: SubmissionService,
|
||||
useClass: SubmissionService
|
||||
}
|
||||
},
|
||||
{
|
||||
provide: HardRedirectService,
|
||||
useClass: BrowserHardRedirectService,
|
||||
},
|
||||
{
|
||||
provide: LocationToken,
|
||||
useFactory: locationProvider,
|
||||
},
|
||||
]
|
||||
})
|
||||
export class BrowserAppModule {
|
||||
|
@@ -29,6 +29,8 @@ import { ServerLocaleService } from 'src/app/core/locale/server-locale.service';
|
||||
import { LocaleService } from 'src/app/core/locale/locale.service';
|
||||
import { HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||
import { ForwardClientIpInterceptor } from '../../app/core/forward-client-ip/forward-client-ip.interceptor';
|
||||
import { HardRedirectService } from '../../app/core/services/hard-redirect.service';
|
||||
import { ServerHardRedirectService } from '../../app/core/services/server-hard-redirect.service';
|
||||
|
||||
export function createTranslateLoader() {
|
||||
return new TranslateJson5UniversalLoader('dist/server/assets/i18n/', '.json5');
|
||||
@@ -88,6 +90,10 @@ export function createTranslateLoader() {
|
||||
useClass: ForwardClientIpInterceptor,
|
||||
multi: true
|
||||
},
|
||||
{
|
||||
provide: HardRedirectService,
|
||||
useClass: ServerHardRedirectService,
|
||||
},
|
||||
]
|
||||
})
|
||||
export class ServerAppModule {
|
||||
|
Reference in New Issue
Block a user