GeneIT/geneit_app/src/api/UserApi.ts

40 lines
701 B
TypeScript
Raw Normal View History

2023-06-09 09:19:40 +00:00
import { APIClient } from "./ApiClient";
export interface User {
id: number;
name: string;
email: string;
time_create: number;
time_activate: number;
active: boolean;
admin: boolean;
has_password: boolean;
}
export class UserApi {
/**
* Get current user information
*/
static async GetUserInfo(): Promise<User> {
return (
await APIClient.exec({
uri: "/user/info",
method: "GET",
})
).data;
}
2023-06-14 12:14:46 +00:00
/**
* Update user profile
*/
static async UpdateProfile(name: string): Promise<void> {
await APIClient.exec({
uri: "/user/update_profile",
method: "POST",
jsonData: {
name: name,
},
});
}
2023-06-09 09:19:40 +00:00
}