File tree Expand file tree Collapse file tree 2 files changed +4
-10
lines changed
playground-nuxt/app/graphql Expand file tree Collapse file tree 2 files changed +4
-10
lines changed Original file line number Diff line number Diff line change 11// This file is auto-generated once by nitro-graphql for quick start
22// You can modify this file according to your needs
3- import type { ExecutionResult } from 'graphql'
43import type { Requester } from './sdk'
54import { getSdk } from './sdk'
65
@@ -15,11 +14,9 @@ export function createGraphQLClient(endpoint: string): Requester {
1514 'Content-Type' : 'application/json' ,
1615 ...headers ,
1716 } ,
18- } ) as ExecutionResult
17+ } )
1918
20- return result . errors ?. length
21- ? Promise . reject ( new Error ( result . errors [ 0 ] ?. message || 'GraphQL error' ) )
22- : result . data as R
19+ return result as R
2320 }
2421}
2522
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ function generateNuxtOfetchClient(clientDir: string) {
1717 if ( ! existsSync ( ofetchPath ) ) {
1818 const ofetchContent = `// This file is auto-generated once by nitro-graphql for quick start
1919// You can modify this file according to your needs
20- import type { ExecutionResult } from 'graphql'
2120import type { Requester } from './sdk'
2221import { getSdk } from './sdk'
2322
@@ -32,11 +31,9 @@ export function createGraphQLClient(endpoint: string): Requester {
3231 'Content-Type': 'application/json',
3332 ...headers,
3433 },
35- }) as ExecutionResult
34+ })
3635
37- return result.errors?.length
38- ? Promise.reject(new Error(result.errors[0]?.message || 'GraphQL error'))
39- : result.data as R
36+ return result as R
4037 }
4138}
4239
You can’t perform that action at this time.
0 commit comments