feat: register an account

This commit is contained in:
Maël Gangloff
2024-08-05 03:11:03 +02:00
parent b569083db6
commit 322ae444b2
9 changed files with 255 additions and 108 deletions

View File

@@ -74,6 +74,7 @@ export interface Watchlist {
export interface InstanceConfig {
ssoLogin: boolean
limtedFeatures: boolean
registerEnabled: boolean
}
export async function request<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig): Promise<R> {

View File

@@ -10,6 +10,16 @@ export async function login(email: string, password: string): Promise<boolean> {
return response.status === 200
}
export async function register(email: string, password: string): Promise<boolean> {
const response = await request({
method: 'POST',
url: 'register',
data: {email, password}
})
return response.status === 201
}
export async function getUser(): Promise<User> {
const response = await request<User>({
url: 'me'