From 57720f5787a2d6abd2420eaa94389de7a353d96a Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Thu, 30 Jul 2026 00:27:56 +0800 Subject: [PATCH] refactor(auth): split types.ts from auth.ts --- apps/web/src/api/auth/types.ts | 82 ++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 apps/web/src/api/auth/types.ts diff --git a/apps/web/src/api/auth/types.ts b/apps/web/src/api/auth/types.ts new file mode 100644 index 000000000..023e0fa32 --- /dev/null +++ b/apps/web/src/api/auth/types.ts @@ -0,0 +1,82 @@ +/** + * 认证相关类型定义 + */ + +export interface LoginRequest { + email: string + password: string +} + +export interface LoginResponse { + access_token: string + refresh_token?: string | null + token_type: string + expires_in: number + user_id: string + email: string + username: string + display_name: string +} + +export interface RegisterRequest { + email: string + password: string + username: string + display_name?: string +} + +export interface User { + id: string + user_id: string + email: string + username: string + display_name: string + is_email_verified: boolean + email_verified: boolean + created_at?: string +} + +export interface UserResponse { + id?: string + user_id?: string + email: string + username: string + display_name: string + is_email_verified?: boolean + email_verified?: boolean + created_at?: string +} + +export interface WechatAuthUrlResponse { + auth_url: string + state: string +} + +export interface WechatCallbackResponse { + access_token: string + refresh_token?: string | null + user_id: string + display_name: string + avatar_url: string + is_new_user: boolean + binding_complete: boolean + expires_in: number +} + +export interface SendVerificationCodeRequest { + target: "email" | "phone" + value: string + purpose: "bind" | "login" | "reset_password" +} + +export interface BindContactRequest { + email?: string + email_code?: string + phone?: string + phone_code?: string +} + +export interface BindContactResponse { + success: boolean + user: User +}