How do I use the @include or @skip directives in the vue-apollo ApolloQuery component?

394 views Asked by At

In template, I am using the component:

<ApolloQuery
:query="require('../graphql/Albums.gql')"
:variables="{ fetchPhotos: true }"
...</ApolloQuery>

My query:

query getAllAlbums ($fetchPhotos: Boolean!){
  albums{
    id
    title
    tags{
      ...Tag
      weight
    }
    carouselItems{
      id,
      mediaUrl
    }
    photos @include(if: $fetchPhotos){
      ...Photo
    }
  }
}

When I execute the query, I'm getting the error "Variable "$fetchPhotos" of required type "Boolean!" was not provided."

How do I supply the @include boolean to the query from the ApolloQuery component?

0

There are 0 answers