renewToken API interface
This commit is contained in:
parent
e1bf25148e
commit
6afe6345cf
1 changed files with 12 additions and 0 deletions
|
@ -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>);
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue