summaryrefslogtreecommitdiffstats
path: root/frontend/components/DeleteItem.js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/components/DeleteItem.js')
-rw-r--r--frontend/components/DeleteItem.js13
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() {