mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-22 16:29:09 +01:00
[PM-2642] Fix feature flags not working properly when urls load from storage (#5598)
* fix: feature flags not working properly Due to race conditions the api url is not set during the first fetch och server config. This causes the config to be fetched from `api.bitwarden.com`. The config is then supposed to be re-fetched when the api url is set by the environment service, but due to a missing line this is not done when the urls are set from storage. * feat: change to `Observable<void>`
This commit is contained in:
parent
3b708d9311
commit
37010a6414
@ -18,7 +18,7 @@ export type PayPalConfig = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export abstract class EnvironmentService {
|
export abstract class EnvironmentService {
|
||||||
urls: Observable<Urls>;
|
urls: Observable<void>;
|
||||||
|
|
||||||
hasBaseUrl: () => boolean;
|
hasBaseUrl: () => boolean;
|
||||||
getNotificationsUrl: () => string;
|
getNotificationsUrl: () => string;
|
||||||
|
@ -8,8 +8,8 @@ import {
|
|||||||
import { StateService } from "../abstractions/state.service";
|
import { StateService } from "../abstractions/state.service";
|
||||||
|
|
||||||
export class EnvironmentService implements EnvironmentServiceAbstraction {
|
export class EnvironmentService implements EnvironmentServiceAbstraction {
|
||||||
private readonly urlsSubject = new Subject<Urls>();
|
private readonly urlsSubject = new Subject<void>();
|
||||||
urls: Observable<Urls> = this.urlsSubject;
|
urls: Observable<void> = this.urlsSubject.asObservable();
|
||||||
|
|
||||||
protected baseUrl: string;
|
protected baseUrl: string;
|
||||||
protected webVaultUrl: string;
|
protected webVaultUrl: string;
|
||||||
@ -139,6 +139,8 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
|
|||||||
this.eventsUrl = envUrls.events = urls.events;
|
this.eventsUrl = envUrls.events = urls.events;
|
||||||
this.keyConnectorUrl = urls.keyConnector;
|
this.keyConnectorUrl = urls.keyConnector;
|
||||||
// scimUrl is not saved to storage
|
// scimUrl is not saved to storage
|
||||||
|
|
||||||
|
this.urlsSubject.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
async setUrls(urls: Urls): Promise<Urls> {
|
async setUrls(urls: Urls): Promise<Urls> {
|
||||||
@ -176,7 +178,7 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
|
|||||||
this.keyConnectorUrl = urls.keyConnector;
|
this.keyConnectorUrl = urls.keyConnector;
|
||||||
this.scimUrl = urls.scim;
|
this.scimUrl = urls.scim;
|
||||||
|
|
||||||
this.urlsSubject.next(urls);
|
this.urlsSubject.next();
|
||||||
|
|
||||||
return urls;
|
return urls;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user