Refactor API requests and update component imports

This commit is contained in:
wangqiao
2025-08-18 14:28:10 +08:00
parent 07b4d3de99
commit 9ae3abeded
91 changed files with 669 additions and 884 deletions

View File

@ -1,5 +1,6 @@
import { post, put } from '@/utils/axios'
import { LoginParams, LoginResponseData, AppAuthLoginRespVO } from './types'
import * as useDollarFetchRequest from '~/composables/useDollarFetchRequest'
import * as useFetchRequest from '~/composables/useFetchRequest'
import type { LoginParams, LoginResponseData, AppAuthLoginRespVO } from './types'
/**
* 新建图纸
@ -7,63 +8,39 @@ import { LoginParams, LoginResponseData, AppAuthLoginRespVO } from './types'
* @returns
*/
export const login = (params: LoginParams) => {
return post<IResponse<LoginResponseData>>({
url: '/prod-api/app-api/member/auth/login',
data: params,
})
return useDollarFetchRequest.post('/prod-api/app-api/member/auth/login', params)
}
/**
* 发送手机验证码
*/
export const sendCode = (params: { mobile: string }) => {
return post<IResponse<any>>({
url: '/prod-api/app-api/member/auth/send-sms-code',
data: params,
})
return useDollarFetchRequest.post('/prod-api/app-api/member/auth/send-sms-code', params)
}
/**
* 使用手机 + 验证码登录
*/
export const loginByMobile = (params: { mobile: string; code: string; socialCode?: string; socialType?: string; socialState?: string }) => {
return post<IResponse<AppAuthLoginRespVO>>({
url: '/prod-api/app-api/member/auth/sms-login',
data: params,
})
return useDollarFetchRequest.post('/prod-api/app-api/member/auth/sms-login', params)
}
/**
* 发送邮箱验证码
*/
export const sendEmailCode = (params: { email: string }) => {
return post<IResponse<any>>({
url: '/prod-api/app-api/member/auth/send-email-code',
data: params,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
})
return useDollarFetchRequest.post('/prod-api/app-api/member/auth/send-email-code', params)
}
/**
* 使用邮箱 + 验证码登录
*/
export const loginByEmail = (params: { email: string; code: string }) => {
return post<IResponse<AppAuthLoginRespVO>>({
url: '/prod-api/app-api/member/auth/verify-code',
data: params,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
})
return useDollarFetchRequest.post('/prod-api/app-api/member/auth/verify-code', params)
}
/**
* 重置密码
*/
export const resetPassoword = (params: { password: string; code: string }) => {
return put<IResponse<boolean>>({
url: '/prod-api/app-api/member/user/update-password',
data: params,
})
export const resetPassword = (params: { password: string; code: string }) => {
return useDollarFetchRequest.put('/prod-api/app-api/member/user/update-password', params)
}