1
0
Fork 0
VaultUI/src/api/sys/getMounts.ts

22 lines
502 B
TypeScript
Raw Normal View History

2021-05-09 11:18:18 +01:00
import { appendAPIURL, getHeaders } from "../apiUtils";
2021-05-08 00:21:58 +01:00
2021-05-10 11:35:14 +01:00
export type MountType = {
2021-05-08 00:21:58 +01:00
type: string
options: {
version: string
}
2021-05-10 11:35:14 +01:00
}
export type MountsType = {
[key: string]: MountType;
2021-05-08 00:21:58 +01:00
}
export async function getMounts(): Promise<MountsType> {
const request = new Request(appendAPIURL("/v1/sys/internal/ui/mounts"), {
2021-05-10 11:35:14 +01:00
headers: getHeaders(),
2021-05-08 00:21:58 +01:00
});
2021-05-10 11:35:14 +01:00
const resp = await fetch(request);
const data = await resp.json() as {data: {secret: MountsType}};
return data.data.secret;
2021-05-08 00:21:58 +01:00
}