vue-apollo

How to add headers in login.vue?

徘徊边缘 提交于 2020-05-16 07:58:06
问题 How to update headers of apolloProvider? Please check out nativescript-vue app repo: https://github.com/kaanguru/vue-apollo-login I can not explain properly so please check out the app. I don't know how to update appolloClient headers. App repo has it's own comments and directives. It's easy to install and see by your self. Current Structure of code: Post request submits the user's identifier and password credentials for authentication and gets token in login page. Apollo needs to place the

@client Apollo GQL tag breaks query

眉间皱痕 提交于 2020-03-02 17:12:24
问题 I have a vue-apollo (using nuxt ) query that is supposed to have a local client field show. However, when I have the show @client line included in the query the component does not render. For some reason it also seems to fail silently. query myAccounts { accounts: myAccounts { email calendars { id name hex_color is_enabled show @client } } } I am extending the Calendar type in an extensions.js file (pasted below) with two mutations. import gql from 'graphql-tag' export const typeDefs = gql`

How to update apollo cache after mutation (query with filter)

一曲冷凌霜 提交于 2020-01-24 22:20:26
问题 I am pretty new to GraphQL. I am using graph.cool in a Vue.js project with apollo. I am using right now the in-memory cache. I had previously a simple 'allPosts' query. And after creating a new one, I used the update() hook and readQuery() + writeQuery() However I want that logged in users can only see their posts. So I modified the query with a filter. query userStreams ($ownerId: ID!) { allStreams(filter: { owner: { id: $ownerId } }) { id name url progress duration watched owner { id } } }

Nuxt JS Apollo data only available after page refresh

六眼飞鱼酱① 提交于 2020-01-23 12:25:11
问题 I am fetching some data using Apollo inside of Nuxt. Somehow, when navigating to that page I get an error of Cannot read property 'image' of undefined When I refresh the page, everything works as expected. I have a found a few threads of people having similar issues but no solution seems to work for me :/ This is my template file right now: /products/_slug.vue <template> <section class="container"> <div class="top"> <img :src="product.image.url"/> <h1>{{ product.name }}</h1> </div> </section>

How to get an vue-apollo instance with @vue/composition-api and nuxt.js

◇◆丶佛笑我妖孽 提交于 2019-12-25 01:31:44
问题 How do I configure vue-apollo ,combined with @vue/apollo-composable for consummation with @vue/composition-api or Vue3.0 ? Because although I get an default apolloClient via using @nuxtjs/apollo : import { DefaultApolloClient } from "@vue/apollo-composable"; const myPlugin: Plugin = (context, inject) => { const defaultClient = ctx.app.apolloProvider.defaultClient; // do stuff with defaultClient, e.g. provide() } export default myPlugin it's still empty instead of populated with my settings

Apollo mutate calling update four times for a single mutation

旧街凉风 提交于 2019-12-23 03:51:54
问题 Every time I add a new item in my app, the mutation calls update() four times, for some reason. The first two are optimistic data, and in the second batch, one is optimistic and one is real data from the network. I can't make any sense of this. The new item being created shows up twice on the page. This is my mutation: mutation CreateTrack($name: String!, $trackNum: Int, $s3Key: String!) { createTrack(name: $name, trackNum: $trackNum, s3Key: $s3Key) { trackId name createdAt duration trackNum

Apollo - update() method getting called twice, both times with optimistic/fake data

吃可爱长大的小学妹 提交于 2019-12-21 07:13:17
问题 I'm completely stuck on an Apollo problem, for which I've opened a GitHub issue and had zero response on. I'm calling an Apollo mutation, using optimisticResponse . The way it's supposed to work, as I understand it, is that update() gets called twice: first with the optimistic data, then again with the actual data coming in from the network. But for some reason, my code is not working like this. I'm getting two update() calls, both with the optimistic data. Here's a repo that demonstrates

Apollo mutate calling update four times for a single mutation

蓝咒 提交于 2019-12-08 19:12:28
Every time I add a new item in my app, the mutation calls update() four times, for some reason. The first two are optimistic data, and in the second batch, one is optimistic and one is real data from the network. I can't make any sense of this. The new item being created shows up twice on the page. This is my mutation: mutation CreateTrack($name: String!, $trackNum: Int, $s3Key: String!) { createTrack(name: $name, trackNum: $trackNum, s3Key: $s3Key) { trackId name createdAt duration trackNum s3Key isProcessing didProcessingFail } } And this is the mutation code: createTrack({ name, s3Key }) {