Last active
January 7, 2019 13:50
-
-
Save strongSoda/98bb0514cc184ce4c16a14cbb3c49e23 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 { markTodo} from './QueryMarkTodos'; | |
import { getTodos } from './QuerygetTodos'; | |
import { Mutation } from "react-apollo"; | |
import Button from 'react-bootstrap/lib/Button'; | |
import { FontAwesomeIcon} from '@fortawesome/react-fontawesome'; | |
import { faCheck } from '@fortawesome/free-solid-svg-icons'; | |
class MarkTodo extends Component { | |
constructor(props) { | |
super(props); | |
this.state = {} | |
} | |
marktodo_completed(update_todos) { | |
update_todos({ variables: this.props, refetchQueries: [{ query: getTodos }] }) | |
// , { query: getAllTodos } | |
} | |
render() { | |
return ( | |
<Mutation mutation={markTodo}> | |
{(update_todos, { data }) => ( | |
<Button onClick={e => { | |
e.preventDefault(); | |
this.marktodo_completed(update_todos); | |
}} ><FontAwesomeIcon icon={faCheck} style={{ color: 'green' }} /></Button> | |
)} | |
</Mutation> | |
); | |
} | |
} | |
export default MarkTodo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment