()
| 14 | interface CartProps {} |
| 15 | |
| 16 | const Cart: React.FC<CartProps> = () => { |
| 17 | const { data, loading, error } = useQuery<GetCartItems>(GET_CART_ITEMS); |
| 18 | |
| 19 | if (loading) return <Loading />; |
| 20 | if (error) return <p>ERROR: {error.message}</p>; |
| 21 | |
| 22 | return ( |
| 23 | <Fragment> |
| 24 | <Header>My Cart</Header> |
| 25 | {data?.cartItems.length === 0 ? ( |
| 26 | <p data-testid="empty-message">No items in your cart</p> |
| 27 | ) : ( |
| 28 | <Fragment> |
| 29 | {data?.cartItems.map((launchId: any) => ( |
| 30 | <CartItem key={launchId} launchId={launchId} /> |
| 31 | ))} |
| 32 | <BookTrips cartItems={data?.cartItems || []} /> |
| 33 | </Fragment> |
| 34 | )} |
| 35 | </Fragment> |
| 36 | ); |
| 37 | }; |
| 38 | |
| 39 | export default Cart; |
nothing calls this directly
no outgoing calls
no test coverage detected