Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package/pyconkr-shop/apis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ namespace ShopAPIRoute {
* @returns 현재 장바구니 상태
*/
export const retrieveCart = () =>
shopAPIClient.get<ShopAPISchema.Order>("v1/orders/cart/");
shopAPIClient.get<ShopAPISchema.Order | ShopAPISchema.EmptyObject>("v1/orders/cart/");

/**
* 장바구니에 상품을 추가합니다.
Expand Down
2 changes: 2 additions & 0 deletions package/pyconkr-shop/schemas/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as R from "remeda";

namespace ShopAPISchema {
export type EmptyObject = Record<string, never>;

export type DetailedErrorSchema = {
code: string;
detail: string;
Expand Down
2 changes: 1 addition & 1 deletion src/debug/page/shop_component/cart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const ShopCartList: React.FC<{ onPaymentCompleted?: () => void; }> = ({ o
// eslint-disable-next-line react-hooks/rules-of-hooks
const { data } = ShopAPIHook.useCart();

return data.products.length === 0
return !data.hasOwnProperty('products') || data.products.length === 0
? <Typography variant="body1" color="error">장바구니가 비어있어요!</Typography>
: <>
{data.products.map((prodRel) => <ShopCartItem key={prodRel.id} cartProdRel={prodRel} disabled={disabled} removeItemFromCartFunc={removeItemFromCart} />)}
Expand Down