Created
March 20, 2019 09:59
-
-
Save siddhant1/6d02b7459ce2eeed5d1856c80df18890 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 GET_ALL_TODOS = gql` | |
{ | |
todos { | |
todo_id | |
todo_text | |
todo_completed | |
todo_user | |
} | |
} | |
`; | |
export const GET_INCOMPLETE_TODOS = gql` | |
{ | |
todos(where: { todo_completed: { _eq: false } }) { | |
todo_id | |
todo_text | |
todo_completed | |
todo_user | |
} | |
} | |
`; | |
export const GET_COMPLETE_TODOS = gql` | |
{ | |
todos(where: { todo_completed: { _eq: true } }) { | |
todo_id | |
todo_text | |
todo_completed | |
todo_user | |
} | |
} | |
`; | |
export const INSERT_TODO_MUTATION = gql` | |
mutation($objects: [todos_insert_input!]!) { | |
insert_todos(objects: $objects) { | |
affected_rows | |
} | |
} | |
`; | |
export const MARK_TODO_COMPLETE = gql` | |
mutation($todo_id: Int!) { | |
update_todos( | |
where: { todo_id: { _eq: $todo_id } } | |
_set: { todo_completed: true } | |
) { | |
affected_rows | |
} | |
} | |
`; | |
export const DELETE_TODO = gql` | |
mutation($todo_id: Int!) { | |
delete_todos(where: { todo_id: { _eq: $todo_id } }) { | |
affected_rows | |
} | |
} | |
`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment