From ccbb924c9a7f6259cac53d25f993bcfbbaec2fc4 Mon Sep 17 00:00:00 2001 From: Timi Date: Fri, 21 Aug 2026 18:14:07 +0800 Subject: [PATCH] support sms login --- src/api/NotifyAPI.ts | 2 +- src/api/UserAPI.ts | 11 ++++++++++- src/types/User.ts | 5 +++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/api/NotifyAPI.ts b/src/api/NotifyAPI.ts index 1484163..85664cc 100644 --- a/src/api/NotifyAPI.ts +++ b/src/api/NotifyAPI.ts @@ -6,7 +6,7 @@ const BASE_URI = "/notify/internal"; export const NotifyAPI = { async smsSend(captchaData: CaptchaData) { - return await axios.post("/sms/captcha/create", captchaData); + return await axios.post("/notify/sms/captcha/create", captchaData); }, /** 查询当前用户的站内通知详情。 */ diff --git a/src/api/UserAPI.ts b/src/api/UserAPI.ts index 06961fa..e7e6f3a 100644 --- a/src/api/UserAPI.ts +++ b/src/api/UserAPI.ts @@ -1,4 +1,4 @@ -import type {Attachment, CaptchaData, Gender, LoginRequest, LoginResponse, RegisterRequest, UpdatePasswordRequest, User, UserAttachType} from "../types"; +import type {Attachment, CaptchaData, Gender, LoginRequest, LoginResponse, RegisterRequest, SmsLoginRequest, UpdatePasswordRequest, User, UserAttachType} from "../types"; import {axios} from "./BaseAPI"; import CommonAPI from "./CommonAPI"; @@ -33,6 +33,15 @@ export const UserAPI = { async login(req: CaptchaData): Promise { return await axios.post(`${BASE_URI}/login`, req); }, + /** + * 短信验证码登录 + * + * @param req 短信验证码登录请求 + * @returns LoginResponse + */ + async loginBySms(req: SmsLoginRequest): Promise { + return await axios.post(`${BASE_URI}/login/sms`, req); + }, /** * 验证是否已登录 * diff --git a/src/types/User.ts b/src/types/User.ts index ebe82a8..5ca87e6 100644 --- a/src/types/User.ts +++ b/src/types/User.ts @@ -50,6 +50,11 @@ export type LoginRequest = { password: string; }; +export type SmsLoginRequest = { + detailId: string; + captcha: string; +}; + export type UpdatePasswordRequest = { oldValue: string; newValue: string;