Skip to content

Commit

Permalink
fix(query): correctly set body definition
Browse files Browse the repository at this point in the history
  • Loading branch information
anymaniax committed Apr 2, 2022
1 parent 0656ae5 commit d5f36c1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/core/generators/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,13 @@ const generateQueryHook = (
export type ${pascal(
operationName,
)}MutationResult = NonNullable<AsyncReturnType<${dataType}>>
export type ${pascal(operationName)}MutationBody = ${definitions.replace(
/^.*data:\s?([\w<>]*),?.*$/,
'$1',
)}
${
body.definition
? `export type ${pascal(operationName)}MutationBody = ${
body.definition
}`
: ''
}
export type ${pascal(operationName)}MutationError = ${errorType}
export const ${camel(`use-${operationName}`)} = <TError = ${errorType},
Expand Down

1 comment on commit d5f36c1

@vercel
Copy link

@vercel vercel bot commented on d5f36c1 Apr 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.