No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Apollo-Client and Quasar v1.1.7

    Help
    2
    2
    502
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      gradlon last edited by

      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

      1 Reply Last reply Reply Quote 0
      • s.molinari
        s.molinari last edited by

        Try following this.

        https://medium.com/quasar-framework/adding-apollo-client-to-quasar-5da265719dc8

        Scott

        1 Reply Last reply Reply Quote 0
        • First post
          Last post