Skip to content

Commit

Permalink
Merge pull request #225 from BCSDLab/fix/option_price_bug
Browse files Browse the repository at this point in the history
[메뉴 추가] 메뉴 추가 및 수정 시 옵션 가격을 null로 변경
  • Loading branch information
chaeseungyun authored Apr 9, 2024
2 parents 4cdcea9 + afdffd9 commit b41260e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/model/shopInfo/newMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
});

Expand Down
2 changes: 1 addition & 1 deletion src/page/AddMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/store/addMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const useAddMenuStore = create<AddMenuStore>((set) => ({
imageUrl: [],
isSingle: true,
name: '',
optionPrices: [{ id: 0, option: '', price: 0 }],
optionPrices: null,
singlePrice: 0,
setCategoryIds: (categoryIds) => set({ categoryIds }),
setDescription: (description) => set({ description }),
Expand All @@ -63,7 +63,7 @@ const useAddMenuStore = create<AddMenuStore>((set) => ({
imageUrl: [],
isSingle: true,
name: '',
optionPrices: [{ id: 0, option: '', price: 0 }],
optionPrices: null,
singlePrice: 0,
}),
resetCategoryIds: () => set({ categoryIds: [] }),
Expand Down

0 comments on commit b41260e

Please sign in to comment.