Tag: graphql
-
How to make the ApolloClient useQuery method to await
0 const claimableItemId = "5ab7c5ab-7a3d-4a92-a62f-2fbd995955f6"; const destAddr = "0x387961b46242A42B445D4354d5048329410613a7"; const [redeemEarnableItem, { data: redeemItem }] = useMutation( REDEEM_EARNABLE_ITEM, { variables: { claimableItemId, destAddr, }, } ); const [getInvoiceDetails, { loading, data: invoiceDetails, refetch }] = useQuery(GET_INVOICE_DETAILS); const redeemHandler = async () => { try { const redeemItem = await redeemEarnableItem(); const id = redeemItem.data.redeemEarnableItem.invoiceID; console.log(id,…
-
GraphQL usage with REST Endpoints in .Net core 6.0
0 Since I am new to GraphQL, I don’t really know how to call a REST Endpoint and query the fields accordingly. In particular, I want to fetch certain fields from the entire response of a GET API. What I have learnt is GraphQL sends a POST Request. How do I hit the GET endpoints…
-
GraphQL only select items of certain type from array
0 In my GraphQL API I have defined a course fragment with an array property lessons. Initially it only had lessons of type TextLesson. Later we added lessons of type VideoLesson as well. fragment TextLessonFields on TextLesson { title body } #fragment VideoLessonFields on VideoLesson { # title # videoUrl #} fragment CourseFields on Course…
-
onCompleted of Apollo’s useLazyQuery does not get called when the execute function resolves
0 I am facing a problem with the following snippet: const [execute] = useLazyQuery(gql` query Example($id: String!) { node(id: $id) { … on Train { id passengers(first: 1) { totalCount } } } } `) useEffect(() => { execute({ onCompleted: () => console.log("Hello world") }) }, []) interface Node { id: ID! } type PassengerConnection…
-
How to use Apollo’s multiple useQuery() hooks in React
2 I need to use 2 queries in my file and I am writing them like so: const {loading, data } = useQuery(getCharactersQuery); const {loading, data} = useQuery(getSingleCharacterQuery); The problem is, they both have the same "loading" and "data" variables and I don’t see anywhere in the docs how can we have different ones. How…
-
GraphQL mutation issue with Enum
0 I have object something like below: type SomeEventInput { event: Event } type Event { type: EventType! } enum EventType { MORNING EVENING AFTERNOON MIDNIGHT } Mutation.SomeEvent(input: SomeEventInput!): Boolean! What i am trying to test it something like : mutation SomeEvent($input: SomeEventInput!) { SomeEventInput(input: {Event: {type: MORNING}}) } But it is showing error for…
-
Laravel Lighthouse / Apollo Client React not sending auth cookies
0 I’m creating a Laravel / React SPA Application using Sanctum Stateful Auth. I’n my local enviroment it works just fine. Cookies are being sent and everything is ok, but when I pass the app to production ( I’m using a shared hosting ). The stateful auth breaks and doesn’t work. It allows me to…
-
How to embed nullable relations in ApiPlatform using GraphQL
0 I am creating an API with ApiPlatform v3.2.1 and make use of the GraphQL features to query the API. How can I make it possible to use nullable embedded relations? For example I have an entity "Ordering" and nullable one-to-one related entities "ProductFoo" and "ProductBar". "ProductFoo" and "ProductBar" relation to "Ordering" is not nullable…
-
Retrieving the last billing cycle using shopify graphQL
0 Is there a way in shopify graphQL to determine the total number of a billing cycles the subscription contract has ? I’ve tried the following query but it requires either billingCyclesDateRangeSelector or billingCyclesIndexRangeSelector, since I do not have the value of max billing cycle I do not have idea about the max date range…
-
GraphQL query is not returning the data at the first fetch itself
0 In my NextJS application, I’m using Apollo Client to query the data. This is the code, //Redeem earnable item const claimableItemId = "5ab7c5ab-7a3d-4a92-a62f-2fbd995955f6"; const destAddr = "0x387961b46242A42B445D4354d5048329410613a7"; const [redeemEarnableItem, { data: redeemItem }] = useMutation( REDEEM_EARNABLE_ITEM, { variables: { claimableItemId, destAddr, }, } ); const { loading, error, data: invoiceDetails, } = useQuery(GET_INVOICE_DETAILS, {…