Add graphic captcha before user SMS login
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { ApiResponse, ChatMessage, ChatSession, LoginResult, UserProfile } from "../types/api";
|
||||
import type { ApiResponse, CaptchaResult, ChatMessage, ChatSession, LoginResult, UserProfile } from "../types/api";
|
||||
|
||||
const API_BASE = import.meta.env.VITE_API_BASE_URL ?? "http://127.0.0.1:8100/api";
|
||||
const TOKEN_KEY = "ai-kb-user-token";
|
||||
@@ -31,7 +31,9 @@ async function request<T>(path: string, init: RequestInit = {}): Promise<T> {
|
||||
}
|
||||
|
||||
export const api = {
|
||||
sendSms: (phone: string) => request<null>("/auth/sms/send", { method: "POST", body: JSON.stringify({ phone }) }),
|
||||
captcha: () => request<CaptchaResult>("/auth/captcha"),
|
||||
sendSms: (phone: string, captchaId: string, captchaCode: string) =>
|
||||
request<null>("/auth/sms/send", { method: "POST", body: JSON.stringify({ phone, captchaId, captchaCode }) }),
|
||||
login: (phone: string, code: string) =>
|
||||
request<LoginResult>("/auth/login", { method: "POST", body: JSON.stringify({ phone, code }) }),
|
||||
logout: () => request<null>("/auth/logout", { method: "POST", body: JSON.stringify({}) }),
|
||||
|
||||
Reference in New Issue
Block a user