graphql

React Apollo updating client cache after mutation

巧了我就是萌 提交于 2021-01-28 07:44:34
问题 I am trying to update my chache after succesfully executing a mutation. Here is my query and mutation: export const Dojo_QUERY = gql` query Dojo($id: Int!){ dojo(id: $id){ id, name, logoUrl, location { id, city, country }, members{ id }, disziplines{ id, name } } }`; export const addDiszipline_MUTATION = gql` mutation createDisziplin($input:DisziplineInput!,$dojoId:Int!){ createDisziplin(input:$input,dojoId:$dojoId){ disziplin{ name, id } } }`; and my mutation call: const [createDisziplin] =

Proper way of refetching queries after mutation in React + ApolloClient project

我与影子孤独终老i 提交于 2021-01-28 06:10:14
问题 Creating an app which allows you to sign up and sign in user in the database. After sign up / sign in process the app moves you to the content. Code for authorization process: const Auth = ({ handleSetAuthorized }) => { const { refetch } = useQuery(CURRENT_USER) const { error } = useSelector(({ error }) => error) const history = useHistory() const dispatch = useDispatch() const [signup] = useMutation(SIGN_UP, { onCompleted: async (data) => { const token = data.signup localStorage.setItem(

dynamic query graphql apollo with java

走远了吗. 提交于 2021-01-28 02:40:14
问题 The routine of working with the graphql apollo is that add file query .graphql i would create dynamic query with java and i do not create file for each query example querys : one : query EntryDetailQuery($repoFullName: String!) { entry(repoFullName: $repoFullName) { id repository { full_name description owner { login } } postedBy { login } } } two : just request full_name query EntryDetailQuery($repoFullName: String!) { entry(repoFullName: $repoFullName) { id repository { full_name } } } in

GraphQL issuing JWT/Cookie

前提是你 提交于 2021-01-27 21:15:00
问题 I am using React as frontend and REST API as backend, my REST is issuing http only Cookie what i am storing on frontend and using on every REST request, for example of code, Atlassian JIRA have auth like that , now i want to migrate that solution from REST to GraphQL, and if authorisation on GraphQL side is already solved problem (only Apollo have both Cookie and JWT auth mechanisms, not to mention native implementations), i still can't figure out how to issue Cookie/JWT from GraphQL side. Is

AWS Appsync implementation using GraphQL-client library in .Net

一个人想着一个人 提交于 2021-01-27 19:43:33
问题 I am trying to implement an app sync subscription similar to this python example but in .net https://aws.amazon.com/blogs/mobile/appsync-websockets-python/ I started this using the nuget package GraphQL.Client https://www.nuget.org/packages/GraphQL.Client The execution of Query/Mutation is working fine like given in the readme of https://github.com/graphql-dotnet/graphql-client But subscription is not working. My code using the GraphQL.Client: using var graphQLClient = new GraphQLHttpClient(

AWS Appsync implementation using GraphQL-client library in .Net

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-27 19:20:29
问题 I am trying to implement an app sync subscription similar to this python example but in .net https://aws.amazon.com/blogs/mobile/appsync-websockets-python/ I started this using the nuget package GraphQL.Client https://www.nuget.org/packages/GraphQL.Client The execution of Query/Mutation is working fine like given in the readme of https://github.com/graphql-dotnet/graphql-client But subscription is not working. My code using the GraphQL.Client: using var graphQLClient = new GraphQLHttpClient(

Using json model field with django graphene

帅比萌擦擦* 提交于 2021-01-27 18:04:01
问题 I'm working with graphql endpoint for my project. One of models has textfield which contains some json. If i request list of my entities via graphql, I'm getting this json like a string. How to reach ability to use it in graphql as nested structure with ability of filtering, choosing some properties etc. class SysObjects(models.Model): id = models.BigAutoField(primary_key=True) user_id = models.BigIntegerField() type_id = models.PositiveIntegerField(blank=True, null=True) # status = models

Apollo client doesn't display an error message

梦想与她 提交于 2021-01-27 17:42:30
问题 I have configured and set up a fully functional express-nextjs-graphql-apollo app that can login/logout a user, and perfectly do CRUD. The last and very important step is to display error messages on client-side. So far, I'm only getting this red error in a console: POST http://localhost:3000/graphql 500 (Internal Server Error) For example, a login form validation. When no input is provided, it's supposed to get an invalid input error message, or E-Mail is invalid if email format is incorrect

Using json model field with django graphene

陌路散爱 提交于 2021-01-27 17:19:43
问题 I'm working with graphql endpoint for my project. One of models has textfield which contains some json. If i request list of my entities via graphql, I'm getting this json like a string. How to reach ability to use it in graphql as nested structure with ability of filtering, choosing some properties etc. class SysObjects(models.Model): id = models.BigAutoField(primary_key=True) user_id = models.BigIntegerField() type_id = models.PositiveIntegerField(blank=True, null=True) # status = models

Correct format for multiline '--data' in curl query to graphql endpoint?

99封情书 提交于 2021-01-27 07:11:59
问题 I'm passing "--data" via curl to a GraphqQL API endpoint. I want to be able to pass the data in 'prettified' form, e.g. as in GraphiQL browser, { alpha { param1 param2 } } Atm, my formatting inside the data -- namely, re: line returns -- isn't handled properly. This single-line-string form works, curl \ -H 'content-type: application/json' \ -X POST /path/to/graphql/api/endpoint \ --data '{ "query": "query { alpha {param1, param2} } " }' This 'prettified' version does not curl \ -H 'content