diff --git a/apps/web/src/api/auth.ts b/apps/web/src/api/auth.ts index b671db6fb..da6e6340f 100644 --- a/apps/web/src/api/auth.ts +++ b/apps/web/src/api/auth.ts @@ -147,13 +147,14 @@ export interface SendVerificationCodeRequest { } export interface BindContactRequest { - target: "email" | "phone" - value: string - code: string + email?: string + email_code?: string + phone?: string + phone_code?: string } export interface BindContactResponse { - message: string + success: boolean user: User } diff --git a/apps/web/src/components/auth/BindContactModal.tsx b/apps/web/src/components/auth/BindContactModal.tsx index 4cfb89724..c600657de 100644 --- a/apps/web/src/components/auth/BindContactModal.tsx +++ b/apps/web/src/components/auth/BindContactModal.tsx @@ -64,14 +64,12 @@ const BindContactModal: React.FC = ({ open, onSuccess, on const values = await form.validateFields() setLoading(true) - const target = activeTab - const value = target === "email" ? values.email : values.phone + const payload = + activeTab === "email" + ? { email: values.email, email_code: values.code } + : { phone: values.phone, phone_code: values.code } - const result = await bindContact({ - target, - value, - code: values.code, - }) + const result = await bindContact(payload) message.success("绑定成功") onSuccess?.(result.user)