Skip to content
Snippets Groups Projects
Commit 3ea7c8d5 authored by Florent Poittevin's avatar Florent Poittevin
Browse files

Add default value for timeoutFactor when appconfig.config is not loaded

parent c369f0e7
No related branches found
No related tags found
No related merge requests found
......@@ -2,9 +2,10 @@ import {HttpClient, HttpHeaders, HttpParams} from "@angular/common/http";
import {Injectable, NgZone, Optional} from "@angular/core";
import {OAuthErrorEvent, OAuthEvent, OAuthInfoEvent, OAuthSuccessEvent} from "@app/core/auth/events";
import {LoginOptions, OAuthStorage, TokenResponse} from "@app/core/auth/types";
import {AppConfigService} from "@app/core/config/app-config.service";
import {Observable, of, Subject, Subscription} from "rxjs";
import {delay, filter} from "rxjs/operators";
import {AppConfigService} from "@app/core/config/app-config.service";
import {environment} from "../../../environments/environment";
@Injectable({
......@@ -392,7 +393,7 @@ export class OAuth2Service {
}
private calcTimeout(storedAt: number, expiration: number): number {
return (expiration - storedAt) * this.appConfig.config.timeoutFactor;
return (expiration - storedAt) * (this.appConfig.config === undefined ? environment.timeoutFactor : this.appConfig.config.timeoutFactor);
}
/**
......
import {ChangeAppLanguage, Login, LoginFail, LoginSuccess, Logout, SetDefaultLanguage, SetMomentLocal} from "@app/stores/app.action";
import {OAuth2Service} from "@app/core/auth/oauth2.service";
import {AppConfigService} from "@app/core/config/app-config.service";
import {BaseState} from "@app/core/models/stores/base.state";
import {LanguagesEnum} from "@app/shared/enums/languages.enum";
import {RoutesEnum} from "@app/shared/enums/routes.enum";
import {SessionStorageEnum} from "@app/shared/enums/session-storage.enum";
import {StateEnum} from "@app/shared/enums/state.enum";
import {UserPreferencesUtil} from "@app/shared/utils/user-preferences.util";
import {ChangeAppLanguage, Login, LoginFail, LoginSuccess, Logout, SetDefaultLanguage, SetMomentLocal} from "@app/stores/app.action";
import {TranslateService} from "@ngx-translate/core";
import {Navigate} from "@ngxs/router-plugin";
import {Action, InitState, State, StateContext, Store} from "@ngxs/store";
import * as moment from "moment";
import {Observable} from "rxjs";
import {tap} from "rxjs/operators";
import {OAuth2Service} from "@app/core/auth/oauth2.service";
import {AppConfigService} from "@app/core/config/app-config.service";
import {BaseState} from "@app/core/models/stores/base.state";
import {environment} from "../../environments/environment";
export interface AppStateModel extends BaseState {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment