perf: perf axios config
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
import { useAxios } from '@/hooks/web/useAxios'
|
||||
import type { UserLoginType, UserType } from './types'
|
||||
import type { UserType } from './types'
|
||||
import { IUserModel } from '@/api-types/user'
|
||||
|
||||
const request = useAxios()
|
||||
|
||||
export const loginApi = (data: UserLoginType) => {
|
||||
return request.post({
|
||||
export const loginApi = async (data: Pick<IUserModel, 'user_name' | 'password'>) => {
|
||||
const res = await request.post<IResponse<IUserModel>>({
|
||||
url: '/user/login',
|
||||
data
|
||||
})
|
||||
return res && res.data
|
||||
}
|
||||
|
||||
export const loginOutApi = () => {
|
||||
|
||||
@@ -8,12 +8,14 @@ interface ICodeModel {
|
||||
uuid: string
|
||||
}
|
||||
|
||||
export const getCodeApi = async () => {
|
||||
const res = await request.get<IResponse<ICodeModel>>({ url: 'user/captcha' })
|
||||
export const getCodeApi = async (): Promise<IResponse<ICodeModel>> => {
|
||||
const res = await request.get({ url: 'user/captcha' })
|
||||
return res && res.data
|
||||
}
|
||||
|
||||
export const registerApi = async (data: Omit<IUserModel, 'is_admin'>) => {
|
||||
const res = await request.post<IResponse<IUserModel>>({ url: 'user/register', data })
|
||||
export const registerApi = async (
|
||||
data: Omit<IUserModel, 'is_admin'>
|
||||
): Promise<IResponse<IUserModel>> => {
|
||||
const res = await request.post({ url: 'user/register', data })
|
||||
return res && res.data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user