diff options
| author | Peggy Rayzis <peggyrayzis@gmail.com> | 2018-05-22 12:55:49 -0400 |
|---|---|---|
| committer | Peggy Rayzis <peggyrayzis@gmail.com> | 2018-05-23 17:26:15 -0400 |
| commit | 8cdede8860f05a2648d17fcb412fb3c2ec3966c9 (patch) | |
| tree | b4789550883c5931d93e5a35a0d7e7e6a1a8f5ca /frontend/components/DeleteItem.js | |
| parent | 21baf56ca199fd9743726c5166b02da4aa6d977b (diff) | |
Rename proxy to cache
Diffstat (limited to 'frontend/components/DeleteItem.js')
| -rw-r--r-- | frontend/components/DeleteItem.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/frontend/components/DeleteItem.js b/frontend/components/DeleteItem.js index 4ef227d..53fc04d 100644 --- a/frontend/components/DeleteItem.js +++ b/frontend/components/DeleteItem.js @@ -1,20 +1,23 @@ import React from 'react'; import { Mutation } from 'react-apollo'; import PropTypes from 'prop-types'; -import { REMOVE_ITEM_MUTATION, ALL_ITEMS_QUERY } from '../queries/queries.graphql'; +import { + REMOVE_ITEM_MUTATION, + ALL_ITEMS_QUERY, +} from '../queries/queries.graphql'; class DeleteItem extends React.Component { static propTypes = { id: PropTypes.string.isRequired, }; - update = (proxy, payload) => { + update = (cache, payload) => { const deletedItem = payload.data.deleteItem; - const data = proxy.readQuery({ query: ALL_ITEMS_QUERY }); + const data = cache.readQuery({ query: ALL_ITEMS_QUERY }); // filter this one out data.items = data.items.filter(item => item.id !== deletedItem.id); - // write the data back to the proxy - proxy.writeQuery({ query: ALL_ITEMS_QUERY, data }); + // write the data back to the cache + cache.writeQuery({ query: ALL_ITEMS_QUERY, data }); }; render() { |
