Questions tagged [vue-apollo]

Apollo/GraphQL integration for VueJS

339 questions
4
votes
2 answers

Access to this.$apollo from Vuex store with vue-apollo in NUXT?

I want to store the user that comes from the login on an action in the vuex store. But there is no access to this.$apollo. export const actions = { UPSERT_USER({ commit }, { authUser, claims }) { this.$apollo .mutate({ …
ctwhome
  • 753
  • 1
  • 13
  • 24
4
votes
1 answer

CORS Error in Laravel 7 using Laravel Lighthouse

I have an API built with Laravel and Lighthouse-php(for GraphQL). My client is built with Vue js and uses Apollo for the graphQL client-side implementation. Anytime I make a request, I get the following error: Access to fetch at…
crazy_abdul
  • 503
  • 6
  • 12
4
votes
0 answers

How to get cookies working with Nuxt Apollo and SSR correctly?

We've built a framework around Nuxt to get it to work with WordPress really well. We have been pulling our hair out trying to get post previewing working. A common setup will be a WordPress install running on a domain like http://api.example.com and…
Drew Baker
  • 14,154
  • 15
  • 58
  • 97
4
votes
5 answers

Enable CORS origin graphql

I'm working on graphQL and spring boot project. The API works well using graphiQL but when trying to consume it using Apollo vueJS, it causes CORS origin error. I'm using @CrossOrigin annotation in ProductQuery class which implements…
Sihem Hcine
  • 1,089
  • 5
  • 24
  • 40
4
votes
0 answers

What is the difference between standard Apollo subscriptions and 'Smart subscriptions'?

I'm not clear from the documentation what the key differences are between these standard Apollo subscriptions and 'Smart Subscriptions'. The docs say that any subscription declared in the apollo.$subscribe option of a Vue component will be a 'Smart…
Winsle
  • 41
  • 2
4
votes
1 answer

How to refetch / update result in vue apollo query that used in a method

I want to update or refetch data in apollo query that used in a method (not apollo object). the thing is i wanted to query and update that query after specific event, so i couldn't use apollo object directly in in my code. methods: { async…
Amir Meimari
  • 520
  • 5
  • 20
4
votes
1 answer

How to handle delete mutations with optimistic UI in Apollo?

https://www.apollographql.com/docs/react/api/react-apollo.html#graphql-mutation-options-optimisticResponse There's plenty of documentation and tutorials showing use of the mutation update and optimisticResponse properties involving adding things,…
ffxsam
  • 26,428
  • 32
  • 94
  • 144
4
votes
1 answer

How do I receive POST requests to my local app from third-party site?

This may be a strange question, but I'm having trouble connecting to a local running app from a hosted website that attempts to POST a form to my local URL/endpoint. I'm sure it is something simple that I'm missing -- or just a lack of knowledge --…
Trip Gould
  • 41
  • 3
4
votes
1 answer

NuxtJS/apollo how to set custom header

How to set custom header on @nuxtjs/apollo? on my nuxt.config.js I have something like this apollo: { "x-token": "hash", "x-auth-token": "hash", "x-refresh-token": "hash", headers: { }, clientConfigs: { default: { //…
Riku
  • 652
  • 1
  • 9
  • 24
4
votes
3 answers

Vue + Apollo: TypeError: this.getClient(...).watchQuery is not a function

I am trying to setup a very simple query using Vue + Apollo (Postgraphile GraphQL server in the backend). In my component I have (in the script tag): import { CURRENT_USER_QUERY } from '../constants/graphql'; export default { name: 'User', …
Daniel da Rocha
  • 887
  • 13
  • 26
4
votes
0 answers

Vue / Apollo: how to update on new subscription message?

I've been trying to get Vue + Apollo to work with my GraphQL server, it works like a charm except for the subscriptions part. I'm using apollo: { foo: { query: ..., subscribeToMore: { document: ..., updateQuery: (previous, {…
TommyF
  • 6,660
  • 8
  • 37
  • 61
3
votes
0 answers

How to use parameters and execute correctly a useLazyQuery from Apollo client in Vue 3?

I'm learning Apollo client with VueJs (Composition API syntax), I got a query that searches a user by the name field, and What I'm trying to do is to trigger the fetch with a @click event on a button next to an input in which you should write the…
Tomas Gil Amoedo
  • 537
  • 3
  • 16
3
votes
1 answer

How to set authentications headers with Vue apollo and composition api?

I've build my app with Vite. I read many documents on web about the topic but I'm still very confused. I've a login form that send credentials to a protected view. When post the data I set the headers and store the Bearer token in the local…
netnull
  • 201
  • 1
  • 3
  • 13
3
votes
0 answers

Vue Apollo auto refresh token implementation

I am trying to implement JWT auth to my SPA, login and logout are done, but i can`t figure out the proper (or just working) way to implement refresh token, any help will be appreciated! I couldn`t find any tutorial about handling refresh token via…
henry_fool
  • 155
  • 6
3
votes
1 answer

Vue/Apollo/graphql client cannot read 'watchQuery' error

I'm trying to consume a remote GraphQL API from Vue using the apollo-client library and having trouble. I get: Error in created hook: "TypeError: Cannot read property 'watchQuery' of undefined" Code is on github at…
1 2
3
22 23