1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-06 09:20:43 +01:00

Add getKeyConnectorAlive to ApiService (#543)

This commit is contained in:
Thomas Rittson 2021-11-18 21:11:55 +10:00 committed by GitHub
parent ea9a8b979d
commit 07dde6e321
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -455,4 +455,5 @@ export abstract class ApiService {
getUserKeyFromKeyConnector: (keyConnectorUrl: string) => Promise<KeyConnectorUserKeyResponse>; getUserKeyFromKeyConnector: (keyConnectorUrl: string) => Promise<KeyConnectorUserKeyResponse>;
postUserKeyToKeyConnector: (keyConnectorUrl: string, request: KeyConnectorUserKeyRequest) => Promise<void>; postUserKeyToKeyConnector: (keyConnectorUrl: string, request: KeyConnectorUserKeyRequest) => Promise<void>;
getKeyConnectorAlive: (keyConnectorUrl: string) => Promise<void>;
} }

View File

@ -1491,6 +1491,21 @@ export class ApiService implements ApiServiceAbstraction {
} }
} }
async getKeyConnectorAlive(keyConnectorUrl: string) {
const response = await this.fetch(new Request(keyConnectorUrl + '/alive', {
cache: 'no-store',
method: 'GET',
headers: new Headers({
'Accept': 'application/json',
'Content-Type': 'application/json; charset=utf-8',
}),
}));
if (response.status !== 200) {
const error = await this.handleError(response, false, true);
return Promise.reject(error);
}
}
// Helpers // Helpers