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 graphql

    Help
    apollo graphql
    4
    8
    1048
    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.
    • N
      nededa last edited by nededa

      Hello,
      I’m trying to use vue-apollo with composition API and in docs it says that I should add this code to root file but there isn’t one.

      Where exactly should I place it?

      import { provide } from '@vue/composition-api'
      import { DefaultApolloClient } from '@vue/apollo-composable'
      
      const app = new Vue({
        setup () {
          provide(DefaultApolloClient, apolloClient)
        },
      
        render: h => h(App),
      })
      

      Docs url: https://v4.apollo.vuejs.org/guide-composable/setup.html#_1-install-vue-apollo-composable

      beets 1 Reply Last reply Reply Quote 0
      • beets
        beets @nededa last edited by

        @nededa Try putting it in App.vue

        1 Reply Last reply Reply Quote 1
        • N
          nededa last edited by

          Yes it worked, thanks. 🙂

          V 1 Reply Last reply Reply Quote 0
          • V
            Vasya @nededa last edited by

            @nededa could you pls provide details, maybe your App.vue code?

            i’m still having issues with that

            N 1 Reply Last reply Reply Quote 0
            • N
              nededa @Vasya last edited by

              @vasya sure, hope it helps. 🙂

              <template>
                <div id="q-app">
                  <router-view />
                </div>
              </template>
              <script lang="ts">
              import { defineComponent, provide } from '@vue/composition-api';
              import { DefaultApolloClient } from '@vue/apollo-composable'
              import ApolloClient from 'apollo-boost'
              
              const apolloClient = new ApolloClient({
                uri: 'http://127.0.0.1/graphql'
              })
              
              export default defineComponent({
                name: 'App',
                setup () {
                  provide(DefaultApolloClient, apolloClient)
                },
              });
              </script>
              
              1 Reply Last reply Reply Quote 1
              • s.molinari
                s.molinari last edited by

                Just know, apollo-boost is no longer valid for working with Apollo Client. You should be getting it from @apollo/client/core.

                Scott

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

                  @s-molinari but why is this still in a docs? https://apollo.vuejs.org/guide/installation.html#_1-apollo-client

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

                    Because those docs are for Version 3 of of vue-apollo @nededa . https://v4.apollo.vuejs.org/guide/installation.html#vue-cli-plugin

                    Scott

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