summaryrefslogtreecommitdiffstats
path: root/frontend/components/Cart.js
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-05-08 13:00:51 -0400
committerWes Bos <wesbos@gmail.com>2018-05-08 13:00:51 -0400
commitad3671675719eb11a81245bffbe0fb18880b479b (patch)
tree561db1323073a22969bef7c5aa4db4a7fe2ad0ed /frontend/components/Cart.js
parentc9a2b488c83dcaae0a00d2177d3bfe1f185c28bf (diff)
omg
Diffstat (limited to 'frontend/components/Cart.js')
-rw-r--r--frontend/components/Cart.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/frontend/components/Cart.js b/frontend/components/Cart.js
index 26f1015..8d57c33 100644
--- a/frontend/components/Cart.js
+++ b/frontend/components/Cart.js
@@ -6,6 +6,7 @@ import formatMoney from '../lib/formatMoney';
import CartItem from './CartItem';
import { CURRENT_USER_QUERY, LOCAL_STATE_QUERY, TOGGLE_CART_MUTATION } from '../queries/queries';
import calcTotalPrice from '../lib/calcTotalPrice';
+import Error from './ErrorMessage';
const CartStyles = styled.div`
padding: 20px;
@@ -78,9 +79,11 @@ const Cart = props => (
{toggle => (
<Query query={LOCAL_STATE_QUERY}>
{({ data }) => (
- <Query query={CURRENT_USER_QUERY}>
+ <Query query={CURRENT_USER_QUERY} data-test="cart">
{({ data: { me }, error, loading }) => {
- if (loading || error || !me) return null;
+ if (loading) return <p>Loading...</p>;
+ if (error) return <Error error={error} />;
+ if (!me) return <p>Please Sign In!</p>;
return (
<CartStyles open={data.cartOpen}>
<header>