From ad3671675719eb11a81245bffbe0fb18880b479b Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Tue, 8 May 2018 13:00:51 -0400 Subject: omg --- frontend/components/Cart.js | 7 +++++-- frontend/components/CreateItem.js | 4 ++-- frontend/components/Pagination.js | 8 +++----- frontend/components/ResetRequest.js | 2 -- 4 files changed, 10 insertions(+), 11 deletions(-) (limited to 'frontend/components') 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 => ( {({ data }) => ( - + {({ data: { me }, error, loading }) => { - if (loading || error || !me) return null; + if (loading) return

Loading...

; + if (error) return ; + if (!me) return

Please Sign In!

; return (
diff --git a/frontend/components/CreateItem.js b/frontend/components/CreateItem.js index 3dd929f..2aabb5b 100644 --- a/frontend/components/CreateItem.js +++ b/frontend/components/CreateItem.js @@ -48,8 +48,8 @@ class CreateItem extends Component { {(createItem, { loading, error }) => (
( {({ data, loading, error }) => { - console.log(error); - if (loading) return null; + if (loading || error) return null; const { aggregate } = data.itemsConnection; const { page } = props; const pages = Math.ceil(aggregate.count / perPage); + // TODO prefetch this return ( - + ( {aggregate.count} Items Total

{ e.preventDefault(); const res = await resetMutation(); - console.log('HEYY'); - console.log(res); }} data-test="ResetRequest" > -- cgit v1.3