diff options
| author | Wes Bos <wesbos@gmail.com> | 2018-02-15 16:59:58 -0500 |
|---|---|---|
| committer | Wes Bos <wesbos@gmail.com> | 2018-02-15 16:59:58 -0500 |
| commit | 8f2c595eca30e2d7138c8e8d6685774a8f44e55d (patch) | |
| tree | 3408b9c8eb3b0ea43cb72e13e0bd6393ab5bac61 /frontend/enhancers | |
| parent | a09b01abf7c03e6b7e43f2175e5a34501808821b (diff) | |
omg
Diffstat (limited to 'frontend/enhancers')
| -rw-r--r-- | frontend/enhancers/enhancers.js | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/frontend/enhancers/enhancers.js b/frontend/enhancers/enhancers.js index 88bebe4..ded59b9 100644 --- a/frontend/enhancers/enhancers.js +++ b/frontend/enhancers/enhancers.js @@ -6,8 +6,9 @@ import { SINGLE_ITEM_QUERY, CURRENT_USER_QUERY, ADD_TO_CART_MUTATION, - UPDATE_NETWORK_STATUS, + UPDATE_UI, GET_UI_STATE, + TOGGLE_CART, } from '../queries/index'; export const itemEnhancer = graphql(ALL_ITEMS_QUERY, { @@ -79,8 +80,21 @@ export const userEnhancer = graphql(CURRENT_USER_QUERY, { name: 'currentUser' }) export const uiEnhancer = graphql(GET_UI_STATE, { name: 'ui' }); -export const networkEnhancer = graphql(UPDATE_NETWORK_STATUS, { - props: ({ mutate }) => ({ - updateNetworkStatus: isConnected => mutate({ variables: { isConnected } }), +export const updateUIEnhancer = graphql(UPDATE_UI, { + props: data => ({ + updateNetworkStatus: isConnected => + data.mutate({ + variables: { + ...data.ownProps.ui.uiData, + isConnected, + }, + }), + toggleCart: isCartOpen => + data.mutate({ + variables: { + ...data.ownProps.ui.uiData, + isCartOpen, + }, + }), }), }); |
