Add TypeScript types to API requests
This commit is contained in:
@ -8,39 +8,39 @@ import type { LoginParams, LoginResponseData, AppAuthLoginRespVO } from './types
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const login = (params: LoginParams) => {
|
export const login = (params: LoginParams) => {
|
||||||
return useDollarFetchRequest.post('/prod-api/app-api/member/auth/login', params)
|
return useDollarFetchRequest.post<IResponse<LoginResponseData>>('/prod-api/app-api/member/auth/login', params)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送手机验证码
|
* 发送手机验证码
|
||||||
*/
|
*/
|
||||||
export const sendCode = (params: { mobile: string }) => {
|
export const sendCode = (params: { mobile: string }) => {
|
||||||
return useDollarFetchRequest.post('/prod-api/app-api/member/auth/send-sms-code', params)
|
return useDollarFetchRequest.post<IResponse<any>>('/prod-api/app-api/member/auth/send-sms-code', params)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 使用手机 + 验证码登录
|
* 使用手机 + 验证码登录
|
||||||
*/
|
*/
|
||||||
export const loginByMobile = (params: { mobile: string; code: string; socialCode?: string; socialType?: string; socialState?: string }) => {
|
export const loginByMobile = (params: { mobile: string; code: string; socialCode?: string; socialType?: string; socialState?: string }) => {
|
||||||
return useDollarFetchRequest.post('/prod-api/app-api/member/auth/sms-login', params)
|
return useDollarFetchRequest.post<IResponse<AppAuthLoginRespVO>>('/prod-api/app-api/member/auth/sms-login', params)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送邮箱验证码
|
* 发送邮箱验证码
|
||||||
*/
|
*/
|
||||||
export const sendEmailCode = (params: { email: string }) => {
|
export const sendEmailCode = (params: { email: string }) => {
|
||||||
return useDollarFetchRequest.post('/prod-api/app-api/member/auth/send-email-code', params)
|
return useDollarFetchRequest.post<IResponse<any>>('/prod-api/app-api/member/auth/send-email-code', params)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用邮箱 + 验证码登录
|
* 使用邮箱 + 验证码登录
|
||||||
*/
|
*/
|
||||||
export const loginByEmail = (params: { email: string; code: string }) => {
|
export const loginByEmail = (params: { email: string; code: string }) => {
|
||||||
return useDollarFetchRequest.post('/prod-api/app-api/member/auth/verify-code', params)
|
return useDollarFetchRequest.post<IResponse<AppAuthLoginRespVO>>('/prod-api/app-api/member/auth/verify-code', params)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置密码
|
* 重置密码
|
||||||
*/
|
*/
|
||||||
export const resetPassword = (params: { password: string; code: string }) => {
|
export const resetPassword = (params: { password: string; code: string }) => {
|
||||||
return useDollarFetchRequest.put('/prod-api/app-api/member/user/update-password', params)
|
return useDollarFetchRequest.put<IResponse<boolean>>('/prod-api/app-api/member/user/update-password', params)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user