From 02e2ed3f526ed076b1be18a6b89fee3159ec0f4d Mon Sep 17 00:00:00 2001 From: Ardeman Date: Sun, 2 Mar 2025 01:36:19 +0800 Subject: [PATCH] feat: transform registration payload to include subscription plan ID and update select options --- app/apis/news/register.ts | 10 +++++++++- app/components/ui/select.tsx | 8 ++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/apis/news/register.ts b/app/apis/news/register.ts index 7004157..67118ea 100644 --- a/app/apis/news/register.ts +++ b/app/apis/news/register.ts @@ -11,7 +11,15 @@ const loginResponseSchema = z.object({ export const newsRegisterRequest = async (payload: TRegisterSchema) => { try { - const { data } = await HttpServer().post('/api/user/register', payload) + const { subscription, ...restPayload } = payload + const transformedPayload = { + ...restPayload, + subscribe_plan_id: subscription, + } + const { data } = await HttpServer().post( + '/api/user/register', + transformedPayload, + ) return loginResponseSchema.parse(data) } catch (error) { // eslint-disable-next-line unicorn/no-useless-promise-resolve-reject diff --git a/app/components/ui/select.tsx b/app/components/ui/select.tsx index d725faa..ad22f82 100644 --- a/app/components/ui/select.tsx +++ b/app/components/ui/select.tsx @@ -53,12 +53,12 @@ export const Select = >( {...rest} > - {options?.map((option) => ( + {options?.map(({ id, name }) => ( ))}