diff --git a/pages/cart.tsx b/pages/cart.tsx
index 5a7b45e79..c7d7d588c 100644
--- a/pages/cart.tsx
+++ b/pages/cart.tsx
@@ -21,7 +21,9 @@ export async function getStaticProps({
}
export default function Cart() {
- const { data, isEmpty } = useCart()
+ const { data, error, isEmpty } = useCart()
+ const isLoading = data === undefined
+
const { price: subTotal } = usePrice(
data && {
amount: data.base_amount,
@@ -37,112 +39,78 @@ export default function Cart() {
const items = data?.line_items.physical_items ?? []
- const error = null
- const success = null
-
- // Loading state
- if (!data) {
- return
Loading...
- }
-
return (
-
-
- {isEmpty ? (
-
-
-
-
-
- Your cart is empty
-
-
- Biscuit oat cake wafer icing ice cream tiramisu pudding cupcake.
-
-
- ) : error ? (
-
-
-
-
-
- We couldn’t process the purchase. Please check your card
- information and try again.
-
-
- ) : success ? (
-
-
-
-
-
- Thank you for your order.
-
-
- ) : (
-
-
My Cart
-
Review your Order
-
- {items.map((item) => (
-
- ))}
-
-
-
- Before you leave, take a look at these items. We picked them
- just for you
-
-
- {[1, 2, 3, 4, 5, 6].map((x) => (
-
+
+
My Cart
+ {error &&
Failed to load
}
+ {isLoading &&
Loading...
}
+ {isEmpty ? (
+
+
+
+
+
+ Your cart is empty
+
+
+ Biscuit oat cake wafer icing ice cream tiramisu pudding cupcake.
+
+
+ ) : (
+
+
+
+
Review your Order
+
+ {items.map((item) => (
+
))}
+
+
+
+
+
+
+
+ -
+ Subtotal
+ {subTotal}
+
+ -
+ Taxes
+ Calculated at checkout
+
+ -
+ Estimated Shipping
+ FREE
+
+
+
+ Total
+ {total}
+
+
+
+
+ {isEmpty ? (
+
+ ) : (
+
+ )}
+
- )}
-
-
-
-
-
- -
- Subtotal
- {subTotal}
-
- -
- Taxes
- Calculated at checkout
-
- -
- Estimated Shipping
- FREE
-
-
-
- Total
- {total}
-
-
-
-
- {isEmpty ? (
-
- ) : (
-
- )}
-
-
-
+ )}
)
}