17 lines
505 B
TypeScript
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;
|
|
});
|
|
}
|