From afdffd93c10dc8e54ad4abb45f1a5a00beee86ec Mon Sep 17 00:00:00 2001 From: chaeseungyun Date: Tue, 9 Apr 2024 15:10:05 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=A9=94=EB=89=B4=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=20=EB=B0=8F=20=EC=88=98=EC=A0=95=20=EC=8B=9C=20=EC=98=B5?= =?UTF-8?q?=EC=85=98=20=EA=B0=80=EA=B2=A9=EC=9D=84=20null=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/shopInfo/newMenu.ts | 2 +- src/page/AddMenu/index.tsx | 2 +- src/store/addMenu.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/model/shopInfo/newMenu.ts b/src/model/shopInfo/newMenu.ts index ab51af65..eb22b131 100644 --- a/src/model/shopInfo/newMenu.ts +++ b/src/model/shopInfo/newMenu.ts @@ -12,7 +12,7 @@ export const NewMenu = z.object({ image_urls: z.array(z.string()), is_single: z.boolean(), name: z.string(), - option_prices: z.array(OptionPrice.nullable()), + option_prices: z.array(OptionPrice.nullable()).nullable(), single_price: z.number(), }); diff --git a/src/page/AddMenu/index.tsx b/src/page/AddMenu/index.tsx index 8a6d4f4c..b517e1e8 100644 --- a/src/page/AddMenu/index.tsx +++ b/src/page/AddMenu/index.tsx @@ -57,7 +57,7 @@ export default function AddMenu() { option_prices: optionPrices?.map(({ option, price }) => ({ option: option === '' ? name : option, price: typeof price === 'string' ? parseInt(price, 10) : price, - })) || [], + })) || null, single_price: typeof singlePrice === 'string' ? parseInt(singlePrice, 10) : singlePrice || 0, }; addMenuMutation(newMenuData); diff --git a/src/store/addMenu.ts b/src/store/addMenu.ts index 95cf046d..98cae8c3 100644 --- a/src/store/addMenu.ts +++ b/src/store/addMenu.ts @@ -39,7 +39,7 @@ const useAddMenuStore = create((set) => ({ imageUrl: [], isSingle: true, name: '', - optionPrices: [{ id: 0, option: '', price: 0 }], + optionPrices: null, singlePrice: 0, setCategoryIds: (categoryIds) => set({ categoryIds }), setDescription: (description) => set({ description }), @@ -63,7 +63,7 @@ const useAddMenuStore = create((set) => ({ imageUrl: [], isSingle: true, name: '', - optionPrices: [{ id: 0, option: '', price: 0 }], + optionPrices: null, singlePrice: 0, }), resetCategoryIds: () => set({ categoryIds: [] }),