不再使用的代码清理
This commit is contained in:
+26
-13
@@ -44,13 +44,22 @@ export class AuthService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取验证码
|
||||
* 获取图形验证码(备用)
|
||||
*/
|
||||
static async getCaptcha(): Promise<CaptchaResponse> {
|
||||
const response = await http.get<CaptchaResponse>('/auth/captcha')
|
||||
return response.data
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信验证码(用于登录/注册/找回密码等场景)
|
||||
*/
|
||||
static async sendSmsCode(phone: string) {
|
||||
// backend-single: GET /auth/sms-code?phone=xxx
|
||||
const response = await http.get('/auth/sms-code', { params: { phone } })
|
||||
return response.data
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登出
|
||||
*/
|
||||
@@ -71,7 +80,8 @@ export class AuthService {
|
||||
* 获取当前用户信息
|
||||
*/
|
||||
static async getCurrentUserInfo(): Promise<UserInfo> {
|
||||
const response = await http.get<UserInfo>('/auth/user/info')
|
||||
// backend-single: GET /auth/userInfo
|
||||
const response = await http.get<UserInfo>('/auth/userInfo')
|
||||
return response.data
|
||||
}
|
||||
|
||||
@@ -94,21 +104,24 @@ export class AuthService {
|
||||
* 重置密码
|
||||
*/
|
||||
static async resetPassword(data: ResetPasswordRequest): Promise<void> {
|
||||
return http.post<void>('/auth/reset-password', data)
|
||||
return http.post<void>('/auth/resetPassword', data)
|
||||
}
|
||||
|
||||
// 废弃:后端未提供该接口,保留新 sendSmsCode()
|
||||
/**
|
||||
* 发送验证码(已废弃:统一使用 sendSmsCode(phone))
|
||||
*/
|
||||
static async sendCode(_data: SendCodeRequest): Promise<void> {
|
||||
console.warn('sendCode 已废弃,请使用 sendSmsCode(phone)')
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送验证码
|
||||
* 验证验证码(不使用,登录由后端校验短信验证码)
|
||||
*/
|
||||
static async sendCode(data: SendCodeRequest): Promise<void> {
|
||||
return http.post<void>('/auth/send-code', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证验证码
|
||||
*/
|
||||
static async verifyCode(data: VerifyCodeRequest): Promise<boolean> {
|
||||
return http.post<boolean>('/auth/verify-code', data)
|
||||
static async verifyCode(_data: VerifyCodeRequest): Promise<boolean> {
|
||||
console.warn('verifyCode 不需要在前端调用,登录时由后端校验短信验证码')
|
||||
return Promise.resolve(true)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user