mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Fixed issue with LocaleInterceptor that blocked new request
This commit is contained in:
@@ -21,8 +21,8 @@ import {
|
|||||||
getAuthenticationToken,
|
getAuthenticationToken,
|
||||||
getRedirectUrl,
|
getRedirectUrl,
|
||||||
isAuthenticated,
|
isAuthenticated,
|
||||||
isTokenRefreshing,
|
isAuthenticatedLoaded,
|
||||||
isAuthenticatedLoaded
|
isTokenRefreshing
|
||||||
} from './selectors';
|
} from './selectors';
|
||||||
import { AppState, routerStateSelector } from '../../app.reducer';
|
import { AppState, routerStateSelector } from '../../app.reducer';
|
||||||
import {
|
import {
|
||||||
@@ -34,7 +34,7 @@ import { NativeWindowRef, NativeWindowService } from '../services/window.service
|
|||||||
import { Base64EncodeUrl } from '../../shared/utils/encode-decode.util';
|
import { Base64EncodeUrl } from '../../shared/utils/encode-decode.util';
|
||||||
import { RouteService } from '../services/route.service';
|
import { RouteService } from '../services/route.service';
|
||||||
import { EPersonDataService } from '../eperson/eperson-data.service';
|
import { EPersonDataService } from '../eperson/eperson-data.service';
|
||||||
import { getAllSucceededRemoteDataPayload } from '../shared/operators';
|
import { getAllSucceededRemoteDataPayload, getFinishedRemoteData, getRemoteDataPayload } from '../shared/operators';
|
||||||
import { AuthMethod } from './models/auth.method';
|
import { AuthMethod } from './models/auth.method';
|
||||||
|
|
||||||
export const LOGIN_ROUTE = '/login';
|
export const LOGIN_ROUTE = '/login';
|
||||||
@@ -206,8 +206,9 @@ export class AuthService {
|
|||||||
return this.store.pipe(
|
return this.store.pipe(
|
||||||
select(getAuthenticatedUserId),
|
select(getAuthenticatedUserId),
|
||||||
hasValueOperator(),
|
hasValueOperator(),
|
||||||
switchMap((id: string) => this.epersonService.findById(id) ),
|
switchMap((id: string) => this.epersonService.findById(id)),
|
||||||
getAllSucceededRemoteDataPayload()
|
getFinishedRemoteData(),
|
||||||
|
getRemoteDataPayload(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Inject } from '@angular/core';
|
import { Inject, Injectable } from '@angular/core';
|
||||||
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
@@ -6,9 +6,9 @@ import { isEmpty, isNotEmpty } from '../../shared/empty.util';
|
|||||||
import { CookieService } from '../services/cookie.service';
|
import { CookieService } from '../services/cookie.service';
|
||||||
import { environment } from '../../../environments/environment';
|
import { environment } from '../../../environments/environment';
|
||||||
import { AuthService } from '../auth/auth.service';
|
import { AuthService } from '../auth/auth.service';
|
||||||
import { Observable, of as observableOf, combineLatest } from 'rxjs';
|
import { combineLatest, Observable, of as observableOf } from 'rxjs';
|
||||||
import { map, take, flatMap } from 'rxjs/operators';
|
import { flatMap, map, take } from 'rxjs/operators';
|
||||||
import { NativeWindowService, NativeWindowRef } from '../services/window.service';
|
import { NativeWindowRef, NativeWindowService } from '../services/window.service';
|
||||||
|
|
||||||
export const LANG_COOKIE = 'language_cookie';
|
export const LANG_COOKIE = 'language_cookie';
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ export enum LANG_ORIGIN {
|
|||||||
UI,
|
UI,
|
||||||
EPERSON,
|
EPERSON,
|
||||||
BROWSER
|
BROWSER
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service to provide localization handler
|
* Service to provide localization handler
|
||||||
@@ -81,12 +81,14 @@ export class LocaleService {
|
|||||||
take(1),
|
take(1),
|
||||||
map((eperson) => {
|
map((eperson) => {
|
||||||
const languages: string[] = [];
|
const languages: string[] = [];
|
||||||
const ePersonLang = eperson.firstMetadataValue(this.EPERSON_LANG_METADATA);
|
if (eperson) {
|
||||||
if (ePersonLang) {
|
const ePersonLang = eperson.firstMetadataValue(this.EPERSON_LANG_METADATA);
|
||||||
languages.push(...this.setQuality(
|
if (ePersonLang) {
|
||||||
[ePersonLang],
|
languages.push(...this.setQuality(
|
||||||
LANG_ORIGIN.EPERSON,
|
[ePersonLang],
|
||||||
!isEmpty(this.translate.currentLang)));
|
LANG_ORIGIN.EPERSON,
|
||||||
|
!isEmpty(this.translate.currentLang)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return languages;
|
return languages;
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user