2024-08-04 15:49:38 +02:00
|
|
|
import {InstanceConfig, request, User} from "./index";
|
2024-07-25 02:09:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
export async function login(email: string, password: string): Promise<boolean> {
|
|
|
|
|
const response = await request({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: 'login',
|
|
|
|
|
data: {email, password}
|
|
|
|
|
})
|
|
|
|
|
return response.status === 200
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function getUser(): Promise<User> {
|
|
|
|
|
const response = await request<User>({
|
|
|
|
|
url: 'me'
|
|
|
|
|
})
|
|
|
|
|
return response.data
|
|
|
|
|
}
|
2024-08-04 15:49:38 +02:00
|
|
|
|
|
|
|
|
export async function getConfiguration(): Promise<InstanceConfig> {
|
|
|
|
|
const response = await request<InstanceConfig>({
|
|
|
|
|
url: 'config'
|
|
|
|
|
})
|
|
|
|
|
return response.data
|
|
|
|
|
}
|