Tag: apollo
-
Can’t access value from apollo response with Vue/Nuxt
0 I have an apollo request which returns some data, but no matter what I do I can’t access the value and at this point I’m all out of ideas, maybe I’m missing something obvious, here’s the request : mutation MyMutation($jwtRefreshToken: String = "") { refreshJwtAuthToken(input: {jwtRefreshToken: $jwtRefreshToken, clientMutationId: "uniqueId"}) { authToken } } JS…
-
Why isn’t my react app mapping my graphQL query?
0 I am working on a component to map all posts from a graphQL query on the client side using semantic UI. I am running it locally and the webpage is not showing any of the data even though this query works in apollo studio. Here’s the code for the component. import React from ‘react’;…
-
Apollo GraphQL Server + TypeScript
17 I’ve been working on a project lately, which has node.js + express + typescript + Apollo server stack. And while researching on Apollo client, I’ve stumbled upon TypeScript section. But nothing like that was for server, which leaves me to freedom of choice in this case. So the question is: are there any best…
-
How to make a query in Apollo Client properly?
0 I’m new to Apollo Client and I want to test API endpoint to fetch the data. const client = new ApolloClient({ cache: new InMemoryCache(), link: new HttpLink({ uri: "https://api.thecatapi.com/v1/breeds", useGETForQueries: true }), }); client .query({ query: gql` { id name } `, }) .then((result) => console.log(result)) In data field I keep getting undefined. I…
-
Graphql in apollo client: local data is not normalized
0 I want to normalize (i.e. flatten nested elements) my graphql’s local cache for efficiency reasons (otherwise a change in a nested item would redraw all components). My understanding was that Apollo would automatically normalize the cache… but apparently it seems like I misunderstood. Indeed, if I do: const IS_LOGGED_IN = gql` query IsUserLoggedIn {…
-
Apollo client: how to create client-side mutations
0 TL;DR: In Apollo client, how can I create client mutations usable with useMutation now that local resolvers are removed? (useful for debug, abstraction, reusability…) Long version: I’m learning how to use Apollo client to deal with a local nested state. For now, I’m using something like: client.writeQuery({ query: IS_LOGGED_IN, data: { isLoggedIn: false, },…
-
How can I cache nested objects with Apollo Client?
3 I’m using the Contentful GraphQL API to fetch a collection of items, in this example football clubs. query Clubs($limit: Int!, $skip: Int!) { clubCollection(limit: $limit, skip: $skip) { total items { name description } } } The structure of the response is: clubCollection: { items: [{ … array of all the clubs }] }…
-
Writing a GraphQL model that programmatically retrieves relevant Neo4j constraints
0 I am a seasoned Neo4j user who is new to GraphQL. I have inherited a codebase that explicitly models all Neo4j nodes and relationships as GraphQL objects. I would like to allow GraphQL users to determine what uniqueness constraints, if any, affect any given object. For an individual object, I believe I can deliver…
-
Unable to connect to the Subscription server even after using graphql-ws
0 const {ApolloServer, gql} = require(‘apollo-server’); const { sequelize } = require(‘./models/index’) const contextMid = require(‘./util/contextMid’) // The GraphQL schema const typeDefs = require(‘./graphql/typeDefs’) // A map of functions which return data for the schema. const resolvers = require(‘./graphql/resolvers’) const server = new ApolloServer({ typeDefs, resolvers, context: contextMid }); server.listen().then(({url})=>{ console.log(`🚀 Server ready at ${url}`)…