summaryrefslogtreecommitdiffstats
path: root/frontend/components/DeleteItem.js
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-04-04 10:38:21 -0400
committerWes Bos <wesbos@gmail.com>2018-04-04 10:38:21 -0400
commita75b2491758a451283e2a373bb3fbe886520b345 (patch)
treeb45d3c6e0685106c0b08049687244fbc8169b27a /frontend/components/DeleteItem.js
parent00df450c84f126c75c4adcd322947f8b77a589d9 (diff)
force network policy
Diffstat (limited to 'frontend/components/DeleteItem.js')
-rw-r--r--frontend/components/DeleteItem.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/frontend/components/DeleteItem.js b/frontend/components/DeleteItem.js
index 30b2bf7..8609ca7 100644
--- a/frontend/components/DeleteItem.js
+++ b/frontend/components/DeleteItem.js
@@ -2,6 +2,7 @@ import React from 'react';
import { Mutation } from 'react-apollo';
import PropTypes from 'prop-types';
import { REMOVE_ITEM_MUTATION, ALL_ITEMS_QUERY } from '../queries/index';
+import Error from './ErrorMessage';
class DeleteItem extends React.Component {
static propTypes = {
@@ -20,7 +21,7 @@ class DeleteItem extends React.Component {
render() {
return (
<Mutation mutation={REMOVE_ITEM_MUTATION} variables={{ id: this.props.id }} update={this.update}>
- {removeItem => (
+ {(removeItem, { error }) => (
<button
onClick={() => {
if (confirm('Are you sure you want to delete this item?')) {
@@ -28,7 +29,7 @@ class DeleteItem extends React.Component {
}
}}
>
- &times; Delete item
+ {error ? error.message : '× Delete Item'}
</button>
)}
</Mutation>