Browse Source

Add getKeyConnectorAlive to ApiService (#543)

pull/558/head
Thomas Rittson 4 years ago committed by GitHub
parent
commit
07dde6e321
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      common/src/abstractions/api.service.ts
  2. 15
      common/src/services/api.service.ts

1
common/src/abstractions/api.service.ts

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

15
common/src/services/api.service.ts

@ -1491,6 +1491,21 @@ export class ApiService implements ApiServiceAbstraction { @@ -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

Loading…
Cancel
Save