This course is no longer maintained and may be out-of-date. While it remains available for reference, its content may not reflect the latest updates, best practices, or supported features.
Update todos - mutation
In this part of the tutorial, you will learn how to mark an existing todo as completed by using GraphQL Mutations.
Let's define a graphql query to do a mutation into todos. In the file src/graphql-operations/index.ts
, add the following:
export const UPDATE_TODO_BY_PK = gql`mutation update_todos_by_pk($pk_columns: todos_pk_columns_input!, $_set: todos_set_input!) {update_todos_by_pk(pk_columns: $pk_columns, _set: $_set) {idtitleis_completedcreated_atis_public}}`
You will also need to pass in the values for the variables.
Try this mutation in GraphiQL against the application database to see what the response looks like.
Let's now integrate this graphql mutation into our vue app.
Build apps and APIs 10x faster
Built-in authorization and caching
8x more performant than hand-rolled APIs

