Tag: javascript
-
Graphql merge (combine) multiple queries into one?
22 I’m trying to combine multiple GraphQL queries into one query using JavaScript. I am looking for something like this: let query3 = mergeQueries(query1, query2); We won’t know beforehand which queries will be combined. Suppose I have queries like this: input query1: { post(id: 1234) { title description } } input query2: { post(id: 1234)…
-
Conditionally render an Astro component based on page type query
0 I am using Astro, GraphQL (Apollo Client), Typescript and React. In my dynamic route: […slug].astro file I need to conditionally render a certain Astro component. I managed to that with: {data.page.type === ‘PageOneType’ && <PageOne />} {data.page.type === ‘PageTwoType’ && <PageTwo />} Can I somehow make this more dynamic, so I don’t have to…
-
How to show Astro component based on a certain field and map the correct data and Astro component in the dynamic slug page
0 I am using Astro, GraphQL (Apollo Client), Typescript and React. For now I think don’t need React yet. I have a dynamic route: […slug].astro I have the following query: export default gql` query Page($pageTarget: String!) { page(pageTarget: $pageTarget) { type content { … on PageOne { id title } … on PageTwo { id…
-
Use dynamically type of generic
0 export const createBill = /* GraphQL */ `mutation CreateBill( $input: CreateBillInput! $condition: ModelBillConditionInput ) { createBill(input: $input, condition: $condition) { periodStart periodEnd energy senderId receiverId metering_point_number file_key customer_number bill_number paid interval id createdAt updatedAt __typename } } ` as GeneratedMutation< APITypes.CreateBillMutationVariables, APITypes.CreateBillMutation >; I have this graphql query wich is automatically generated. Now i…
-
How can I display a pdf using a graphQL query and react?
-1 My task is to use a query, send the mandatory variables and get a pdf from the BE. Right now, I have the code but I can’t get the pdf downloaded. In the network tab I can see my request and the response is a url as string This is the request: query getCollectionReportOverview(…
-
How can I use my query from graphQL and get pdf downloaded?
-1 My task is to use a query, send the mandatory variables and get a pdf from the BE. Right now, I have the code but I can’t get the pdf downloaded. In the network tab I can see my request but nothing in the response. This is the request: query getCollectionReportOverview( $filterReportCollectionOverview: ReportCollectionOverviewInput! )…
-
How can I use this graphQL DTO in my react app?
0 I have been given a task that I have to use a query and download a pdf when I click on a button. The thing is that I’m new to graphQL and the backend guy has just sent to me this type Query{ getCollectionReportOverview(filterReportCollectionOverview:ReportCollectionOverview ): String! } input ReportCollectionOverview { collectionNumbers: [Int]! collectionNames: [String]!…
-
How can I use this grapql DTO n my react app?
0 I have been given a task that I have to use a query and download a pdf when I click on a button. The thing is that I’m new to graphQL and the backend guy has just sent to me this type Query{ getCollectionReportOverview(filterReportCollectionOverview:ReportCollectionOverview ): String! } input ReportCollectionOverview { collectionNumbers: [Int]! collectionNames: [String]!…
-
How to accept POST request from a remote server on a GraphQL Server
0 I am working on a project currently using GrapQL. I am integrating a payment processor, when the user payment is successful, the payment processor sends a POST request to the webhook URL that is meant to point to my server. Now I was wondering how to achieve this, considering that GraphQL exposes just one…