const apolloClient = new Apollo.lib.ApolloClient({
networkInterface: Apollo.lib.createNetworkInterface({
uri: "http://my-website/graphql",
transportBatching: true
}),
connectToDevTools: true
});
const apolloProvider = new VueApollo.ApolloProvider({
defaultClient: apolloClient
});
const POSTS_QUERY = Apollo.gql`
{
posts {
edges {
node {
title
guid
date
excerpt
postId
_wp_attached_file
_starter_content_theme
_thumbnail_id
slug
status
featuredImage
{
guid
}
}
}
}
}
`;
// New VueJS instance
const app = new Vue({
el: "#app",
data: {
posts: [],
loading: 0
},
mounted () {
},
// Apollo GraphQL
apolloProvider,
apollo: {
posts: {
query: POSTS_QUERY,
loadingKey: "loading"
}
}
});