Last active
January 7, 2019 13:50
-
-
Save strongSoda/ead09a72b2b78fff5592e1aa5638b3d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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