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: [] }),