Can sign out
This commit is contained in:
@ -57,6 +57,7 @@ export class APIClient {
|
||||
method: args.method,
|
||||
body: body,
|
||||
headers: headers,
|
||||
credentials: "include",
|
||||
});
|
||||
|
||||
// Process response
|
||||
|
@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user