From b082013bbacbbe8e2ec753b03a42274cad850ee6 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 22 Jul 2026 13:57:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(web):=20#558=20=E4=BF=AE=E5=A4=8Dbind-conta?= =?UTF-8?q?ct=E6=8E=A5=E5=8F=A3=E5=AD=97=E6=AE=B5=E5=90=8D=EF=BC=8C?= =?UTF-8?q?=E5=AF=B9=E9=BD=90=E5=90=8E=E7=AB=AFBindContactRequest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 后端字段为email/email_code/phone/phone_code, 前端之前传target/value/code导致400错误。 --- apps/web/src/api/auth.ts | 9 +++++---- apps/web/src/components/auth/BindContactModal.tsx | 12 +++++------- 2 files changed, 10 insertions(+), 11 deletions(-) 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)