Check environment for userInfoSubject
This commit is contained in:
parent
1488f8ef00
commit
23dc2cc074
|
@ -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<User> = new AdvancedAsyncSubject<User>();
|
||||
private getUserInfoSubject: AdvancedAsyncSubject<User> | BehaviorSubject<User>;
|
||||
public fixRedirectURL: string = null;
|
||||
private redirectUrl: string = null;
|
||||
private readonly promise: Promise<User>;
|
||||
|
@ -23,6 +23,11 @@ export class UserManagementService {
|
|||
|
||||
constructor(private http: HttpClient,
|
||||
private router: Router) {
|
||||
if(properties.environment === "development") {
|
||||
this.getUserInfoSubject = new AdvancedAsyncSubject<User>();
|
||||
} else {
|
||||
this.getUserInfoSubject = new BehaviorSubject<User>(null)
|
||||
}
|
||||
this.promise = new Promise<any>((resolve => {
|
||||
this.updateUserInfo(resolve);
|
||||
}));
|
||||
|
|
Loading…
Reference in New Issue