Files
apollo/docs/guide/components/mutation.md
T
Guillaume Chau 56f317af07 docs: big update
2018-06-18 18:11:46 +02:00

559 B

ApolloMutation

You can use the ApolloMutation (or apollo-mutation) component to call Apollo mutations directly in your template.

Here is an example:

<ApolloMutation
  :mutation="require('@/graphql/userLogin.gql')"
  :variables="{
    email,
    password,
  }"
  @done="onDone"
>
  <template slot-scope="{ mutate, loading, error }">
    <button :disabled="loading" @click="mutate()">Click me</button>
    <p v-if="error">An error occured: {{ error }}</p>
  </template>
</ApolloMutation>

See API Reference.