Apollo-Client and Quasar v1.1.7



  • Hi,
    I am trying to get Apollo-Client up en Running, but am having some difficulties with it.

    boot/apollo.js

    import { ApolloClient } from 'apollo-client'
    import { InMemoryCache } from 'apollo-cache-inmemory'
    import VueApollo from 'vue-apollo'
    import fetch from 'node-fetch'
    import { createHttpLink } from 'apollo-link-http'
    
    const httpLink = createHttpLink({ uri: 'http://localhost:4000/graphql', fetch: fetch })
    
    // Create the apollo client
    const apolloClient = new ApolloClient({
      link: httpLink,
      cache: new InMemoryCache(),
      connectToDevTools: true
    })
    

    And then in MyLayout.vue

          <li v-for="item in author" :key="item.id">
            <h6>{{item.userName}}</h6>
            <ul>
              <li>{{item.email}}</li>
              <li>{{item.author}}</li>
              <li>{{item.id}}</li>
            </ul>
          </li>
        </ul>
    
    <script>
    import { gql } from 'apollo-boost'
    const authorQuery = gql`
      query {
        getUsers{userName, email, id, author}
      }`
    export default {
      name: 'MyLayout',
    
      data () {
        return {
          leftDrawerOpen: false,
          author: []
        }
      },
      methods: {
      },
      apollo: {
        // Simple query that will update the 'author' vue property
        author: authorQuery
      }
    }
    </script>
    

    The result is that noting is happening.
    I tried with older examples that i found by googling which worked but only for quasar < 1.0.
    Can anyone provide some help?

    Kind regards
    Gradlon




Log in to reply