Fixed issue with LocaleInterceptor that blocked new request

This commit is contained in:
Giuseppe Digilio
2020-09-03 14:46:52 +02:00
parent 99c0f6ceaa
commit a76e0796c6
2 changed files with 19 additions and 16 deletions

View File

@@ -21,8 +21,8 @@ import {
getAuthenticationToken,
getRedirectUrl,
isAuthenticated,
isTokenRefreshing,
isAuthenticatedLoaded
isAuthenticatedLoaded,
isTokenRefreshing
} from './selectors';
import { AppState, routerStateSelector } from '../../app.reducer';
import {
@@ -34,7 +34,7 @@ import { NativeWindowRef, NativeWindowService } from '../services/window.service
import { Base64EncodeUrl } from '../../shared/utils/encode-decode.util';
import { RouteService } from '../services/route.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';
export const LOGIN_ROUTE = '/login';
@@ -207,7 +207,8 @@ export class AuthService {
select(getAuthenticatedUserId),
hasValueOperator(),
switchMap((id: string) => this.epersonService.findById(id)),
getAllSucceededRemoteDataPayload()
getFinishedRemoteData(),
getRemoteDataPayload(),
)
}

View File

@@ -1,4 +1,4 @@
import { Injectable, Inject } from '@angular/core';
import { Inject, Injectable } from '@angular/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 { environment } from '../../../environments/environment';
import { AuthService } from '../auth/auth.service';
import { Observable, of as observableOf, combineLatest } from 'rxjs';
import { map, take, flatMap } from 'rxjs/operators';
import { NativeWindowService, NativeWindowRef } from '../services/window.service';
import { combineLatest, Observable, of as observableOf } from 'rxjs';
import { flatMap, map, take } from 'rxjs/operators';
import { NativeWindowRef, NativeWindowService } from '../services/window.service';
export const LANG_COOKIE = 'language_cookie';
@@ -19,7 +19,7 @@ export enum LANG_ORIGIN {
UI,
EPERSON,
BROWSER
};
}
/**
* Service to provide localization handler
@@ -81,6 +81,7 @@ export class LocaleService {
take(1),
map((eperson) => {
const languages: string[] = [];
if (eperson) {
const ePersonLang = eperson.firstMetadataValue(this.EPERSON_LANG_METADATA);
if (ePersonLang) {
languages.push(...this.setQuality(
@@ -88,6 +89,7 @@ export class LocaleService {
LANG_ORIGIN.EPERSON,
!isEmpty(this.translate.currentLang)));
}
}
return languages;
})
);