This commit is contained in:
2023-06-02 23:53:07 +08:00
parent afb2e49345
commit 4dedacf449
31 changed files with 1368 additions and 1236 deletions

20
src/api/account.ts Normal file
View File

@@ -0,0 +1,20 @@
import QueryAPI from '@/api/query'
import { BASE_API } from '@/data/constants'
import { APIRoot } from './api-models'
const ACCOUNT_URL = `${BASE_API}account/`
export async function Register(name: string, email: string, password: string): Promise<APIRoot<string>> {
return QueryAPI<string>(`${ACCOUNT_URL}register`, {
name,
email,
password,
})
}
export async function Login(nameOrEmail: string, password: string): Promise<APIRoot<string>> {
return QueryAPI<string>(`${ACCOUNT_URL}login`, {
nameOrEmail,
password,
})
}