1
0
Fork 0
VaultUI/src/api/getTransitKeys.ts
2021-05-08 00:21:58 +01:00

17 lines
505 B
TypeScript

import { DoesNotExistError } from "../types/internalErrors";
import { appendAPIURL, getHeaders } from "./apiUtils";
export async function getTransitKeys(baseMount: string): Promise<string[]> {
const request = new Request(appendAPIURL(`/v1/${baseMount}/keys?list=true`), {
headers: getHeaders(),
});
return fetch(request).then(response => {
if (response.status == 404) {
throw DoesNotExistError;
}
return response.json();
}).then(data => {
return data.data.keys;
});
}