apollo

Updating uri of apollo client instance

白昼怎懂夜的黑 提交于 2020-06-17 00:15:12
问题 I'm using Angular Apollo for one of our project. I'm creating the apollo client as: this.apollo.create({ link: this.httpLink.create({ uri: `${environment.apiBase}/graphql?access_token=${this.tokenService.token}`}), cache: new InMemoryCache() }) Since our uri has an access token which also gets expired after a certain point of time, we had to refresh it and get the new access token, hence a new uri. I was unable find any method in apollo docs regarding the way to update the uri(maybe I've

Updating uri of apollo client instance

China☆狼群 提交于 2020-06-17 00:14:11
问题 I'm using Angular Apollo for one of our project. I'm creating the apollo client as: this.apollo.create({ link: this.httpLink.create({ uri: `${environment.apiBase}/graphql?access_token=${this.tokenService.token}`}), cache: new InMemoryCache() }) Since our uri has an access token which also gets expired after a certain point of time, we had to refresh it and get the new access token, hence a new uri. I was unable find any method in apollo docs regarding the way to update the uri(maybe I've

Apollo GraphQL (React) Data sharing across components

♀尐吖头ヾ 提交于 2020-06-14 07:46:47
问题 I just started using react-apollo and was wondering what was the best way to share data across components. For example, I have componentA which is using grapql from react-apollo to fetch some data ( WrappedA ). I also have some other component, componentB , somewhere else in my UI and want to use the data already fetched by componentA . Attached a very simple example below. const ComponentA = ({ ...props }) => ( <div> ComponentA... id: {props.organisationsData.organisations.id} </div> ) const

Apollo: Call a mutation server-side from cron job? [duplicate]

試著忘記壹切 提交于 2020-06-13 00:14:32
问题 This question already has answers here : Apollo GraphQL: Call a Mutation from the Server? (2 answers) Closed 18 days ago . I have a Meteor app that uses Apollo and I am using SyncedCron (https://github.com/percolatestudio/meteor-synced-cron) to schedule an update operation on the database every 2 hours. Every two hours, fetch X data from some external API and store in Y collection of the database. Rinse and repeat. My question is this: should this update operation be implemented as a graphQL

Why Express (or other integration) with Apollo GraphQL Sever?

只愿长相守 提交于 2020-06-12 02:56:28
问题 I am struggling to understand the added value of Express (or Koa, Hapi, etc) integration with Apollo GraphQL server. I see it can work in stand alone mode very well (an example: https://medium.com/codingthesmartway-com-blog/apollo-server-2-introduction-efc4026f5654). In which case should we use it with (or without) integration? What should drive this decision? 回答1: If all you need is a GraphQL endpoint, then using the standalone library ( apollo-server ) is generally preferred because there

Why Express (or other integration) with Apollo GraphQL Sever?

雨燕双飞 提交于 2020-06-12 02:55:14
问题 I am struggling to understand the added value of Express (or Koa, Hapi, etc) integration with Apollo GraphQL server. I see it can work in stand alone mode very well (an example: https://medium.com/codingthesmartway-com-blog/apollo-server-2-introduction-efc4026f5654). In which case should we use it with (or without) integration? What should drive this decision? 回答1: If all you need is a GraphQL endpoint, then using the standalone library ( apollo-server ) is generally preferred because there

Why Express (or other integration) with Apollo GraphQL Sever?

筅森魡賤 提交于 2020-06-12 02:55:07
问题 I am struggling to understand the added value of Express (or Koa, Hapi, etc) integration with Apollo GraphQL server. I see it can work in stand alone mode very well (an example: https://medium.com/codingthesmartway-com-blog/apollo-server-2-introduction-efc4026f5654). In which case should we use it with (or without) integration? What should drive this decision? 回答1: If all you need is a GraphQL endpoint, then using the standalone library ( apollo-server ) is generally preferred because there

Apollo GraphQL: Call a Mutation from the Server?

China☆狼群 提交于 2020-06-09 05:34:08
问题 I need to call a mutation from a cron job running on the server. I found this SO post, but the accepted answer said there was no way to do it. Then I found this on GitHub, from 2017: graphql-server is an network wrapper for graphql core function. if you don't want to use it over network, you can just run it standalone: import scheme from './scheme'; const query = `{ me { name } }`; const result = graphql(scheme, query); console.log(result); function documentation can be found here That looks

Custom ApolloProvider for access to React Context inside

烈酒焚心 提交于 2020-06-01 05:08:40
问题 I created ApolloCustomProvider because I want to use addNotification function from my AppContext for graphQL error handling. The problem is that this custom provider seems to work while querying or mutating API but errorLink 's functions like addNotification and console.log() doesn't work. Also console.log() from request function doesn't print anything. But when I put everything from ApolloCustomProvider to standard TypeScript file (.ts - not React Component) and then use it like: import {

Apollo react hooks array object mutation

北城余情 提交于 2020-06-01 04:44:21
问题 So I am doing a MARN stack using MongoDB, Apollo, React Native (Expo) and Node I am stuck trying to figure out how to upload an array of object. i.e A post with an array of shots It is all working fine in the Apollo playground with this: mutation createPost { createPost( input: { shots: [ { title: "Test test test" content: "Test test test" image: "https://source.unsplash.com/random/768x768" } { title: "Best best best" content: "Test test test" image: "https://source.unsplash.com/random