support sms login

This commit is contained in:
Timi
2026-08-21 18:14:07 +08:00
parent 98ab992728
commit ccbb924c9a
3 changed files with 16 additions and 2 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ const BASE_URI = "/notify/internal";
export const NotifyAPI = { export const NotifyAPI = {
async smsSend(captchaData: CaptchaData<Notify>) { async smsSend(captchaData: CaptchaData<Notify>) {
return await axios.post("/sms/captcha/create", captchaData); return await axios.post("/notify/sms/captcha/create", captchaData);
}, },
/** 查询当前用户的站内通知详情。 */ /** 查询当前用户的站内通知详情。 */
+10 -1
View File
@@ -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 {axios} from "./BaseAPI";
import CommonAPI from "./CommonAPI"; import CommonAPI from "./CommonAPI";
@@ -33,6 +33,15 @@ export const UserAPI = {
async login(req: CaptchaData<LoginRequest>): Promise<LoginResponse> { async login(req: CaptchaData<LoginRequest>): Promise<LoginResponse> {
return await axios.post(`${BASE_URI}/login`, req); return await axios.post(`${BASE_URI}/login`, req);
}, },
/**
* 短信验证码登录
*
* @param req 短信验证码登录请求
* @returns LoginResponse
*/
async loginBySms(req: SmsLoginRequest): Promise<LoginResponse> {
return await axios.post(`${BASE_URI}/login/sms`, req);
},
/** /**
* 验证是否已登录 * 验证是否已登录
* *
+5
View File
@@ -50,6 +50,11 @@ export type LoginRequest = {
password: string; password: string;
}; };
export type SmsLoginRequest = {
detailId: string;
captcha: string;
};
export type UpdatePasswordRequest = { export type UpdatePasswordRequest = {
oldValue: string; oldValue: string;
newValue: string; newValue: string;