gohttpdUi/src/api/register/index.ts

22 lines
538 B
TypeScript
Raw Normal View History

2022-06-23 22:37:49 +08:00
import { useAxios } from '@/hooks/web/useAxios'
import { IUserModel } from '@/api-types/user'
const request = useAxios()
2022-06-24 21:36:33 +08:00
interface ICodeModel {
url: string
uuid: string
}
2022-06-25 20:04:58 +08:00
export const getCodeApi = async (): Promise<IResponse<ICodeModel>> => {
const res = await request.get({ url: 'user/captcha' })
2022-06-24 21:36:33 +08:00
return res && res.data
2022-06-23 22:37:49 +08:00
}
2022-06-25 20:04:58 +08:00
export const registerApi = async (
data: Omit<IUserModel, 'is_admin'>
): Promise<IResponse<IUserModel>> => {
const res = await request.post({ url: 'user/register', data })
2022-06-24 21:36:33 +08:00
return res && res.data
2022-06-23 22:37:49 +08:00
}