From 23dc2cc07492d8986e2890b3df47bf185a86b816 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Mon, 8 Nov 2021 11:36:28 +0200 Subject: [PATCH] Check environment for userInfoSubject --- services/user-management.service.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/services/user-management.service.ts b/services/user-management.service.ts index a19e85cb..ab3666c4 100644 --- a/services/user-management.service.ts +++ b/services/user-management.service.ts @@ -1,6 +1,6 @@ import {Injectable} from '@angular/core'; import {HttpClient} from '@angular/common/http'; -import {from, Observable} from "rxjs"; +import {BehaviorSubject, from, Observable} from "rxjs"; import {COOKIE, Session, User} from "../login/utils/helper.class"; import {map} from "rxjs/operators"; import {NavigationEnd, Router} from "@angular/router"; @@ -14,7 +14,7 @@ import {AdvancedAsyncSubject} from "../utils/AdvancedAsyncSubject"; }) export class UserManagementService { - private getUserInfoSubject: AdvancedAsyncSubject = new AdvancedAsyncSubject(); + private getUserInfoSubject: AdvancedAsyncSubject | BehaviorSubject; public fixRedirectURL: string = null; private redirectUrl: string = null; private readonly promise: Promise; @@ -23,6 +23,11 @@ export class UserManagementService { constructor(private http: HttpClient, private router: Router) { + if(properties.environment === "development") { + this.getUserInfoSubject = new AdvancedAsyncSubject(); + } else { + this.getUserInfoSubject = new BehaviorSubject(null) + } this.promise = new Promise((resolve => { this.updateUserInfo(resolve); }));