Can sign out

This commit is contained in:
2023-09-04 15:12:00 +02:00
parent 44d565c6da
commit d67f42abc5
9 changed files with 184 additions and 7 deletions

View File

@ -57,6 +57,7 @@ export class APIClient {
method: args.method,
body: body,
headers: headers,
credentials: "include",
});
// Process response

View File

@ -1,5 +1,9 @@
import { APIClient } from "./ApiClient";
export interface AuthInfo {
id: string;
}
const TokenStateKey = "auth-state";
export class AuthApi {
@ -71,6 +75,18 @@ export class AuthApi {
this.SetAuthenticated();
}
/**
* Get auth information
*/
static async GetAuthInfo(): Promise<AuthInfo> {
return (
await APIClient.exec({
uri: "/auth/user",
method: "GET",
})
).data;
}
/**
* Sign out
*/