graphql

How to execute a directive before a mutation is committed to the database?

懵懂的女人 提交于 2021-01-05 07:43:25
问题 I'm trying to add the internationalization feature to my database. It would be quite difficult to maintain a schema graphql if I needed to duplicate all translatable fields type Quest { name @i18n # simple } type Quest { nameEn nameJa nameFr ... # omg } The problem I'm facing is that field directives are only executed during a query (or, once a mutation has finished, to return the result). I do not see how I could do something similar with resolvers. For any possible mutation, I want to check

How to declare array from API in place of hardcoded array?

╄→гoц情女王★ 提交于 2021-01-05 07:35:15
问题 I was given an example for some code that has an array hardcoded. Im looking to swap this out for my array that is pulled in from an API using graphql. Below is the code pen to the original example & another for what i've tried with no avail. I'm pretty new to graphql & js so likely an amateur mistake, any pointers would be much appreciated! Original code - https://codesandbox.io/s/nice-saha-gwbwv My pen - https://codesandbox.io/s/quiet-wind-brq8s?file=/src/App.js 回答1: I would change your

refresh token for angular using graphql and apollo client

≯℡__Kan透↙ 提交于 2021-01-05 07:34:27
问题 I'm trying to set up a refresh token strategy to refresh JWT in angular 9 with GraphQL and apollo client when my first request returns a 401. I have set up a new angular module for graphql where I'm creating my apolloclient. Everything works great even with authenticated requests but I need to have my normal refresh token strategy work as well (re-make and return the original request after refresh token cycle completes). I have found only a few resources to help with this and I've gotten

How to declare array from API in place of hardcoded array?

扶醉桌前 提交于 2021-01-05 07:33:42
问题 I was given an example for some code that has an array hardcoded. Im looking to swap this out for my array that is pulled in from an API using graphql. Below is the code pen to the original example & another for what i've tried with no avail. I'm pretty new to graphql & js so likely an amateur mistake, any pointers would be much appreciated! Original code - https://codesandbox.io/s/nice-saha-gwbwv My pen - https://codesandbox.io/s/quiet-wind-brq8s?file=/src/App.js 回答1: I would change your

How do you publish a gatsby project with gatsby-image on Netlify?

随声附和 提交于 2021-01-02 03:47:37
问题 So I can locally build my gatsby project no problem, but when Netlify tries to build, I get the error Field "featuredImage" must not have a selection since type "String" has no subfields. 5:34:38 PM: This can happen if you e.g. accidentally added { } to the field "featuredImage". If you didn't expect "featuredImage" to be of type "String" make sure that your input source and/or plugin is correct. 5:34:38 PM: error There was an error in your GraphQL query: 5:34:38 PM: Field "featuredImage"

How do you publish a gatsby project with gatsby-image on Netlify?

瘦欲@ 提交于 2021-01-02 03:47:24
问题 So I can locally build my gatsby project no problem, but when Netlify tries to build, I get the error Field "featuredImage" must not have a selection since type "String" has no subfields. 5:34:38 PM: This can happen if you e.g. accidentally added { } to the field "featuredImage". If you didn't expect "featuredImage" to be of type "String" make sure that your input source and/or plugin is correct. 5:34:38 PM: error There was an error in your GraphQL query: 5:34:38 PM: Field "featuredImage"

How to Upload files in graphql using graphene-file-upload with apollo-upload-client to Python Database and react front-end.?

女生的网名这么多〃 提交于 2020-12-31 15:28:56
问题 I'm trying to upload a file to a django backend using graphene-file-upload which has the mutation to link the backend to the react frontend where I'm trying to use apollo-upload client to link it with graphql. In my django model an empty file is being successfully uploaded but it is not uploading the real file which I'm selecting but uploads an empty file. Like it uploads nothing {} but the instance is created in the database where another story is added which is empty. Here is some of my

How to Upload files in graphql using graphene-file-upload with apollo-upload-client to Python Database and react front-end.?

浪子不回头ぞ 提交于 2020-12-31 15:22:08
问题 I'm trying to upload a file to a django backend using graphene-file-upload which has the mutation to link the backend to the react frontend where I'm trying to use apollo-upload client to link it with graphql. In my django model an empty file is being successfully uploaded but it is not uploading the real file which I'm selecting but uploads an empty file. Like it uploads nothing {} but the instance is created in the database where another story is added which is empty. Here is some of my

GraphQL ERESOLVE unable to resolve dependency tree when building my docker container

╄→гoц情女王★ 提交于 2020-12-30 08:15:20
问题 Here are my files. Here is I think the core of the problem. Could not resolve dependency: npm ERR! peer graphql@"^0.12.0 || ^0.13.0 || ^14.0.0" from graphql-middleware@4.0.2 docker-compose.yml version: '3.7' services: apollo: container_name: apollo build: context: . dockerfile: Dockerfile environment: - NODE_ENV=development volumes: - '.:/app' - '/app/node_modules' ports: - 4000:4000 restart: always Dockerfile # Use the official image as a parent image. FROM node:current-slim # Set the

GraphQL ERESOLVE unable to resolve dependency tree when building my docker container

这一生的挚爱 提交于 2020-12-30 08:14:31
问题 Here are my files. Here is I think the core of the problem. Could not resolve dependency: npm ERR! peer graphql@"^0.12.0 || ^0.13.0 || ^14.0.0" from graphql-middleware@4.0.2 docker-compose.yml version: '3.7' services: apollo: container_name: apollo build: context: . dockerfile: Dockerfile environment: - NODE_ENV=development volumes: - '.:/app' - '/app/node_modules' ports: - 4000:4000 restart: always Dockerfile # Use the official image as a parent image. FROM node:current-slim # Set the