1
0
mirror of https://github.com/bitwarden/jslib synced 2025-12-15 15:53:51 +00:00

Add helper methods to EnvironmentService for retrieving urls (#435)

This commit is contained in:
Oscar Hinton
2021-07-23 20:03:52 +02:00
committed by GitHub
parent c77441b353
commit de288913e4
19 changed files with 234 additions and 158 deletions

View File

@@ -153,12 +153,6 @@ import { UserKeyResponse } from '../models/response/userKeyResponse';
import { SendAccessView } from '../models/view/sendAccessView';
export abstract class ApiService {
urlsSet: boolean;
apiBaseUrl: string;
identityBaseUrl: string;
eventsBaseUrl: string;
setUrls: (urls: EnvironmentUrls) => void;
postIdentityToken: (request: TokenRequest) => Promise<IdentityTokenResponse | IdentityTwoFactorResponse | IdentityCaptchaResponse>;
refreshIdentityToken: () => Promise<any>;

View File

@@ -1,14 +1,29 @@
export abstract class EnvironmentService {
baseUrl: string;
webVaultUrl: string;
apiUrl: string;
identityUrl: string;
iconsUrl: string;
notificationsUrl: string;
eventsUrl: string;
enterpriseUrl: string;
import { Observable } from 'rxjs';
export type Urls = {
base?: string;
webVault?: string;
api?: string;
identity?: string;
icons?: string;
notifications?: string;
events?: string;
enterprise?: string;
};
export abstract class EnvironmentService {
urls: Observable<Urls>;
hasBaseUrl: () => boolean;
getNotificationsUrl: () => string;
getEnterpriseUrl: () => string;
getWebVaultUrl: () => string;
getSendUrl: () => string;
getIconsUrl: () => string;
getApiUrl: () => string;
getIdentityUrl: () => string;
getEventsUrl: () => string;
setUrlsFromStorage: () => Promise<void>;
setUrls: (urls: any) => Promise<any>;
setUrls: (urls: any, saveSettings?: boolean) => Promise<Urls>;
getUrls: () => Urls;
}

View File

@@ -1,7 +1,5 @@
import { EnvironmentService } from './environment.service';
export abstract class NotificationsService {
init: (environmentService: EnvironmentService) => Promise<void>;
init: () => Promise<void>;
updateConnection: (sync?: boolean) => Promise<void>;
reconnectFromActivity: () => Promise<void>;
disconnectFromInactivity: () => Promise<void>;