File tree Expand file tree Collapse file tree 3 files changed +4
-2
lines changed
src/debug/page/shop_component Expand file tree Collapse file tree 3 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ namespace ShopAPIRoute {
8686 * @returns 현재 장바구니 상태
8787 */
8888 export const retrieveCart = ( ) =>
89- shopAPIClient . get < ShopAPISchema . Order > ( "v1/orders/cart/" ) ;
89+ shopAPIClient . get < ShopAPISchema . Order | ShopAPISchema . EmptyObject > ( "v1/orders/cart/" ) ;
9090
9191 /**
9292 * 장바구니에 상품을 추가합니다.
Original file line number Diff line number Diff line change 11import * as R from "remeda" ;
22
33namespace ShopAPISchema {
4+ export type EmptyObject = Record < string , never > ;
5+
46 export type DetailedErrorSchema = {
57 code : string ;
68 detail : string ;
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ export const ShopCartList: React.FC<{ onPaymentCompleted?: () => void; }> = ({ o
8080 // eslint-disable-next-line react-hooks/rules-of-hooks
8181 const { data } = ShopAPIHook . useCart ( ) ;
8282
83- return data . products . length === 0
83+ return ! data . hasOwnProperty ( 'products' ) || data . products . length === 0
8484 ? < Typography variant = "body1" color = "error" > 장바구니가 비어있어요!</ Typography >
8585 : < >
8686 { data . products . map ( ( prodRel ) => < ShopCartItem key = { prodRel . id } cartProdRel = { prodRel } disabled = { disabled } removeItemFromCartFunc = { removeItemFromCart } /> ) }
You can’t perform that action at this time.
0 commit comments