Merge 2 queries from *.gql files into 1 query #3265
Answered
by
n1ru4l
arishojaei
asked this question in
Q&A
-
I have some queries in # /user/account.gql
query userData {
Me {
id
email
level
avatar
first_name
last_name
}
} # /ticket/list.gql
query ticketData ($id:ID,$offset:Int,$limit:Int) {
Tickets(id:$id, offset:$offset, limit:$limit, pagination:true ) {
id
status
title
updated_at
}
} // Some JS file
import { print } from 'graphql/language/printer';
import userAcount from '../graphql/queries/user/acount.gql'
import ticketList from '../graphql/queries/tickets/list.gql'
const userAcountQuery = print(userAcount)
const ticketListQuery = print(ticketList) |
Beta Was this translation helpful? Give feedback.
Answered by
n1ru4l
Sep 20, 2021
Replies: 1 comment
-
I built this a while back, it might be useful to you: https://github.com/n1ru4l/graphql-operation-merger/blob/main/src/mergeGraphQLOperations.ts |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
saihaj
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I built this a while back, it might be useful to you: https://github.com/n1ru4l/graphql-operation-merger/blob/main/src/mergeGraphQLOperations.ts