apollo-client

refreshing a token with apollo-client + firebase auth

落爺英雄遲暮 提交于 2019-12-25 18:56:09
问题 I'm having some trouble figuring out token refreshes when using apollo-client and firebase's auth service. I've setup token refresh using apollo client before. Typically I use the apollo-link-error package (apollo-link-error docs). My understanding is you get the latest token from firebase auth with a promise like: firebase.auth().currentUser.getIdToken How to use the Firebase refreshToken to reauthenticate? reading the answer from this post: When you make call from a browser .getIdToken(true

http parse exception apollo Graphql

老子叫甜甜 提交于 2019-12-25 04:11:38
问题 I am getting http parse exception while using Apollo GraphQL Client for Android, but i can able to see json data with status code 200 when debugging with HttpLoggingInterceptor Anyone went over this issue? Below is the method to call graphql query private void getData(){ HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor() .setLevel(HttpLoggingInterceptor.Level.BODY); OkHttpClient httpClient = new OkHttpClient.Builder() .addInterceptor(interceptor) .build(); ApolloClient

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

React-Native + Apollo-Link-State + AWS Appsync : Defaults are not stored in cache

元气小坏坏 提交于 2019-12-25 00:16:05
问题 I'm struggling with this for days. I've successfully configure Apollo-Link-State with AppSync a month ago and start adding defaults and resolvers like this : const cache = new InMemoryCache() //create the cache to be shared by appsync and apollo-link-state const appSyncAtrributes = { //... //setup appSync } const stateLink = createLinkWithCache(() => withClientState({ cache, resolvers: { Mutation: { updateCurrentUser: (_, { username, thumbnailUrl }, { cache }) => { // ... // working mutation

Apollo boost - __typename in query prevent new mutation

百般思念 提交于 2019-12-24 01:36:19
问题 I have a problem in my meteor/react/apollo (with boost) project. When I query data from the server, it adds __typename to every object and subobject in my query but it my case it creates a major issue as I normally reuse these data to send them to other mutation. Now the other mutation tell me there is an error because the __typename field is not defined in my graphql schema. I tried to fix by adding the addTypename: false field to my apollo client but it didn't change anything (note I am

Authentication for GitHub API v4 with Apollo-Client

断了今生、忘了曾经 提交于 2019-12-23 23:37:16
问题 GitHub's new GraphQL API requires authentication with a token as the previous version. So, how do we add a 'Header' information into the HttpLink inside Apollo-Client ? const client = new ApolloClient({ link: new HttpLink({ uri: 'https://api.github.com/graphql' }), cache: new InMemoryCache() }); 回答1: You can define authorization header using apollo-link-context , check the header section A complete example for using apollo-client for Github API would be : import { ApolloClient } from 'apollo

How to create nested nodes in one mutation?

浪尽此生 提交于 2019-12-23 09:57:07
问题 Hi I am trying to write data on my https://www.graph.cool/ db with a mutation. My project is a React web-app and I am using Apollo as graphql client and graphql-tag npm package as template literal parser. The problem is that i don't know how to arrange the gql template string for the correct mutation with nested data. My schema looks like this, for example note the field "Addresses" for the type "Company" is an array of "Address" objects type. type Company { name: String! website: String

How to create nested nodes in one mutation?

≡放荡痞女 提交于 2019-12-23 09:55:47
问题 Hi I am trying to write data on my https://www.graph.cool/ db with a mutation. My project is a React web-app and I am using Apollo as graphql client and graphql-tag npm package as template literal parser. The problem is that i don't know how to arrange the gql template string for the correct mutation with nested data. My schema looks like this, for example note the field "Addresses" for the type "Company" is an array of "Address" objects type. type Company { name: String! website: String

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

GraphQL Query Runs Sucessfully One Time and Fails To Run Again using Apollo and AWS AppSync

佐手、 提交于 2019-12-23 02:44:29
问题 I'm using the basic client configuration from the example on the first page of https://github.com/awslabs/aws-mobile-appsync-sdk-js repo: const client = new AWSAppSyncClient({ url: appSyncConfig.graphqlEndpoint, region: appSyncConfig.region, auth: { type: appSyncConfig.authenticationType, apiKey: appSyncConfig.apiKey, } }); But without the <Rehydrated> component, and with a Redux <Provider> component. The highest level parent component is wrapped like this: <Provider store={store}>