index.ts 538 B

123456789101112131415161718192021
  1. import { useAxios } from '@/hooks/web/useAxios'
  2. import { IUserModel } from '@/api-types/user'
  3. const request = useAxios()
  4. interface ICodeModel {
  5. url: string
  6. uuid: string
  7. }
  8. export const getCodeApi = async (): Promise<IResponse<ICodeModel>> => {
  9. const res = await request.get({ url: 'user/captcha' })
  10. return res && res.data
  11. }
  12. export const registerApi = async (
  13. data: Omit<IUserModel, 'is_admin'>
  14. ): Promise<IResponse<IUserModel>> => {
  15. const res = await request.post({ url: 'user/register', data })
  16. return res && res.data
  17. }