1
0
Fork 0
VaultUI/src/api/renewSelf.js
2021-05-07 11:53:26 +01:00

21 lines
484 B
JavaScript

import { appendAPIURL, getHeaders } from "./apiUtils.js";
export async function renewSelf() {
const request = new Request(appendAPIURL("/v1/auth/token/renew-self"), {
method: 'POST',
headers: {
...getHeaders(),
'Content-Type': 'application/json'
},
body: JSON.stringify({})
});
return fetch(request).then(response => {
return response.json();
}).then(data => {
if ("errors" in data) {
throw new Error(data.errors[0]);
}
});
}