1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-02-12 00:41:29 +01:00

get rid of useCredentials variable

This commit is contained in:
Kyle Spearrin 2019-08-22 12:04:15 -04:00
parent 8a0d371d20
commit fbc7d6c2bc

View File

@ -109,23 +109,22 @@ export class ApiService implements ApiServiceAbstraction {
identityBaseUrl: string; identityBaseUrl: string;
eventsBaseUrl: string; eventsBaseUrl: string;
private device: DeviceType;
private deviceType: string; private deviceType: string;
private isWebClient = false; private isWebClient = false;
private isDesktopClient = false; private isDesktopClient = false;
private usingBaseUrl = false; private usingBaseUrl = false;
private useCredentials = true;
constructor(private tokenService: TokenService, private platformUtilsService: PlatformUtilsService, constructor(private tokenService: TokenService, private platformUtilsService: PlatformUtilsService,
private logoutCallback: (expired: boolean) => Promise<void>) { private logoutCallback: (expired: boolean) => Promise<void>) {
const device = platformUtilsService.getDevice(); this.device = platformUtilsService.getDevice();
this.deviceType = device.toString(); this.deviceType = this.device.toString();
this.isWebClient = device === DeviceType.IEBrowser || device === DeviceType.ChromeBrowser || this.isWebClient = this.device === DeviceType.IEBrowser || this.device === DeviceType.ChromeBrowser ||
device === DeviceType.EdgeBrowser || device === DeviceType.FirefoxBrowser || this.device === DeviceType.EdgeBrowser || this.device === DeviceType.FirefoxBrowser ||
device === DeviceType.OperaBrowser || device === DeviceType.SafariBrowser || this.device === DeviceType.OperaBrowser || this.device === DeviceType.SafariBrowser ||
device === DeviceType.UnknownBrowser || device === DeviceType.VivaldiBrowser; this.device === DeviceType.UnknownBrowser || this.device === DeviceType.VivaldiBrowser;
this.isDesktopClient = device === DeviceType.WindowsDesktop || device === DeviceType.MacOsDesktop || this.isDesktopClient = this.device === DeviceType.WindowsDesktop || this.device === DeviceType.MacOsDesktop ||
device === DeviceType.LinuxDesktop; this.device === DeviceType.LinuxDesktop;
this.useCredentials = device !== DeviceType.SafariExtension;
} }
setUrls(urls: EnvironmentUrls): void { setUrls(urls: EnvironmentUrls): void {
@ -1017,7 +1016,7 @@ export class ApiService implements ApiServiceAbstraction {
} }
private getCredentials(): RequestCredentials { private getCredentials(): RequestCredentials {
if (this.useCredentials && (!this.isWebClient || this.usingBaseUrl)) { if (this.device !== DeviceType.SafariExtension && (!this.isWebClient || this.usingBaseUrl)) {
return 'include'; return 'include';
} }
return undefined; return undefined;