Skip to content

ReQurv/vue-apollo-async

Repository files navigation

Async Vue Apollo functions

The project create the async version of useQuery and useMutation on a vue based projects with Vue Apollo server.

Authors

Installation

Install with yarn:

  yarn add @requrv/vue-apollo-async

Install with npm:

  npm install @requrv/vue-apollo-async

Usage/Examples

import ReQurvApollo from '@requrv/vue-apollo-async'

const requrvApollo = new ReQurvApollo()

// Mutation
const { apolloMutation } = requrvApollo.useAsyncMutation({
    document: MutationDocument,
    options: {
        variables: {
            ...any variables
        }
    }
})
const { data } = await apolloMutation() // data is the mutation result

// Query
const { apolloQuery } = requrvApollo.useAsyncQuery({
    document: QueryDocument,
    variables: {
        ...any variables
    }
})
const { data } = await apolloQuery() // data is the query result

License

MIT