Skip to content

Instantly share code, notes, and snippets.

@strongSoda
Last active January 7, 2019 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save strongSoda/ead09a72b2b78fff5592e1aa5638b3d4 to your computer and use it in GitHub Desktop.
Save strongSoda/ead09a72b2b78fff5592e1aa5638b3d4 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import { deleteTodo} from './QueryDeleteTodos';
import { getTodos } from './QuerygetTodos';
import { faTimes } from '@fortawesome/free-solid-svg-icons';
import { Mutation } from "react-apollo";
import Button from 'react-bootstrap/lib/Button';
import { FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import Form from 'react-bootstrap/lib/Form';
import FormGroup from 'react-bootstrap/lib/FormGroup';
import InputGroup from 'react-bootstrap/lib/InputGroup';
class DeleteTodo extends Component {
constructor(props) {
super(props);
this.state = {}
}
deletetodo(delete_todos) {
delete_todos({ variables: this.props, refetchQueries: [{ query: getTodos }] });
}
render() {
return (
<Mutation mutation={deleteTodo}>
{(delete_todos, { data }) => (
<Button onClick={e => {
e.preventDefault();
this.deletetodo(delete_todos);
}} ><FontAwesomeIcon icon={faTimes} style={{ color: 'red' }} /></Button>
)}
</Mutation>
);
}
}
export default DeleteTodo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment