Skip to content

Instantly share code, notes, and snippets.

@himanshu-dixit
Created December 15, 2018 12:11
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 himanshu-dixit/f7572769a1122b245ddb3bcde4079b73 to your computer and use it in GitHub Desktop.
Save himanshu-dixit/f7572769a1122b245ddb3bcde4079b73 to your computer and use it in GitHub Desktop.
import gql from 'graphql-tag';
export const getTodos = gql`{
todo(order_by: []){
id
task
user
completed
}
}`;
export const addTodo = gql`
mutation($task: String!, $user: String! ,$completed: Boolean!) {
insert_todo(
objects: [
{
task: $task,
user: $user,
completed: false
}
]
){
affected_rows
}
}
`;
export const deleteTodo = gql`
mutation($id: Int!) {
delete_todo(
where: {id: {_eq:$id}}
){
affected_rows
}
}
`;
export const updateTodo = gql`
mutation($id: Int!) {
update_todo(
where: {id: {_eq:$id}}
_set: {completed: true}
){
affected_rows
}
}
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment