Created
December 15, 2018 12:11
-
-
Save himanshu-dixit/f7572769a1122b245ddb3bcde4079b73 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 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