Co-authored-by: Imbus <imbus64@users.noreply.github.com>

This commit is contained in:
Hollgy 2024-03-14 11:24:31 +01:00
commit 327f90e448

View file

@ -9,6 +9,8 @@ interface API {
removeUser(username: string): Promise<User>;
/** Create a project */
createProject(project: NewProject): Promise<Project>;
/** Renew the token */
renewToken(token: string): Promise<string>;
}
// Export an instance of the API
@ -42,4 +44,14 @@ export const api: API = {
body: JSON.stringify(project),
}).then((res) => res.json() as Promise<Project>);
},
async renewToken(token: string): Promise<string> {
return fetch("/api/loginrenew", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + token,
},
}).then((res) => res.json() as Promise<string>);
},
};