@@ -22,11 +22,11 @@ interface IQuery {
2222
2323const Context = createContext < IGraphqlBatcher | undefined > ( undefined ) ;
2424
25- const executor : AsyncExecutor = async ( { document, variables, extensions } ) => {
25+ const fetch = async ( url , document , variables ) => {
2626 try {
2727 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2828 //@ts -ignore
29- const result = request ( extensions . url , document , variables ) . then ( ( res ) => ( {
29+ const result = request ( url , document , variables ) . then ( ( res ) => ( {
3030 data : res ,
3131 } ) ) as Promise < ExecutionResult > ;
3232
@@ -38,12 +38,29 @@ const executor: AsyncExecutor = async ({ document, variables, extensions }) => {
3838 }
3939} ;
4040
41- const batchExec = createBatchingExecutor ( executor ) ;
41+ const coreExecutor : AsyncExecutor = async ( { document, variables } ) => {
42+ return fetch ( getGraphqlUrl ( false ) , document , variables ) ;
43+ } ;
44+
45+ const dtrExecutor : AsyncExecutor = async ( { document, variables } ) => {
46+ return fetch ( getGraphqlUrl ( true ) , document , variables ) ;
47+ } ;
48+
49+ const coreBatchExec = createBatchingExecutor ( coreExecutor ) ;
50+ const dtrBatchExec = createBatchingExecutor ( dtrExecutor ) ;
4251
4352const fetcher = async ( queries : IQuery [ ] ) => {
4453 const batchdata = await Promise . all (
45- queries . map ( ( { document, variables, isDisputeTemplate, chainId } ) =>
46- batchExec ( { document, variables, extensions : { url : getGraphqlUrl ( isDisputeTemplate ?? false , chainId ) } } )
54+ queries . map ( ( { document, variables, isDisputeTemplate } ) =>
55+ isDisputeTemplate
56+ ? dtrBatchExec ( {
57+ document,
58+ variables,
59+ } )
60+ : coreBatchExec ( {
61+ document,
62+ variables,
63+ } )
4764 )
4865 ) ;
4966
0 commit comments