Skip to content

Commit 5c7a665

Browse files
committed
Fix TypeError: Cannot read property 'currentUser' of undefined
1 parent 21e6645 commit 5c7a665

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/landing/TshirtOrderForm.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const ORDER_TSHIRT = gql`
3131

3232
const TshirtOrderForm = () => (
3333
<Query query={ADDRESS_QUERY}>
34-
{({ data: { currentUser: { id, shippingAddress } = {} } }) => (
34+
{({ data }) => (
3535
<Mutation mutation={ORDER_TSHIRT}>
3636
{orderTshirt => (
3737
<Formik
@@ -87,6 +87,8 @@ const TshirtOrderForm = () => (
8787
values.size
8888
}%0D%0AShipping address:%0D%0A%0D%0A%0D%0A%0D%0AUID: ${id}`
8989

90+
const { id, shippingAddress } = (data && data.currentUser) || {}
91+
9092
return (
9193
<form className="TshirtOrderForm" onSubmit={handleSubmit}>
9294
<FormControl error={showProductError}>

0 commit comments

Comments
 (0)