MCPcopy Create free account
hub / github.com/apollographql/fullstack-tutorial / Cart

Function Cart

final/client/src/pages/cart.tsx:16–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14interface CartProps {}
15
16const 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
39export default Cart;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected