移动端和 PC 端登录页都加了“图形验证码

This commit is contained in:
yml2213
2026-06-12 21:16:08 +08:00
parent 8cfb63a3e7
commit f6ea3e29a6
13 changed files with 456 additions and 84 deletions
+14 -1
View File
@@ -25,11 +25,24 @@ export interface LoginData {
tokens: TokenPair
}
export async function sendSmsCode(phone: string) {
export interface AuthCaptcha {
captcha_id: string
image: string
expires_in: number
}
export async function fetchAuthCaptcha() {
const { data } = await apiClient.get<ApiResponse<AuthCaptcha>>('/auth/captcha')
return data.data
}
export async function sendSmsCode(phone: string, captchaId: string, captchaCode: string) {
const { data } = await apiClient.post<ApiResponse<{ phone: string; expires_in: number }>>(
'/auth/sms/send',
{
phone,
captcha_id: captchaId,
captcha_code: captchaCode,
}
)
return data.data