Skip to content

Commit 745fee0

Browse files
committed
fix: update query params types
1 parent 88af725 commit 745fee0

File tree

2 files changed

+4
-25
lines changed

2 files changed

+4
-25
lines changed

src/generateHooks.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ export const createHook = ({
366366
if (!requestBodyComponent && !paramsInPath.length && !queryParam && headerParam) {
367367
const config = isUpdateRequest ? 'null,{headers}' : '{headers}';
368368
output += `
369-
export type ${componentName}Params = {
369+
export type ${componentName}Params = {
370370
${headerParam}
371371
};
372372
@@ -419,7 +419,7 @@ export const createHook = ({
419419
output += `
420420
export type ${componentName}Params = ${body} & {
421421
${headerParam}
422-
${paramsTypes}
422+
${queryParamsType}
423423
};
424424
export const ${fetchName} = async (${bodyProps}: ${componentName}Params) => {
425425
${generateBodyProps()}
@@ -450,6 +450,7 @@ export const createHook = ({
450450
export type ${componentName}Params = ${body} & {
451451
${headerParam}
452452
${paramsTypes}
453+
${queryParamsType}
453454
};
454455
455456
export const ${fetchName} = async (${bodyProps}: ${componentName}Params) => {

test/script.mjs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,7 @@
11
import { importSpecs } from '../dist/importSpecs.js';
22

33
importSpecs({
4-
sourceUrls: [
5-
{
6-
name: 'locations',
7-
url: 'https://developer.yourtravis.com/apis/6551f664dcc3f80001c43645/documentation/raw',
8-
},
9-
{
10-
name: 'bookings',
11-
url: 'https://developer.yourtravis.com/apis/65af901265a19f00010aad03/documentation/raw',
12-
},
13-
{
14-
name: 'driver',
15-
url: 'https://developer.yourtravis.com/apis/664df3a089431e0001d72c9b/documentation/raw',
16-
},
17-
{
18-
name: 'vehicles',
19-
url: 'https://developer.yourtravis.com/apis/664df0135b6a0d0001d9bb5e/documentation/raw',
20-
},
21-
{
22-
name: 'fuel-cards',
23-
url: 'https://developer.yourtravis.com/apis/663a39195182e000017f0276/documentation/raw',
24-
},
25-
],
26-
// sourceDirectory: 'test/specs-private',
4+
sourceDirectory: 'test/specs-private',
275
exportDirectory: 'test/generated',
286
apiDirectory: '../../api',
297
queryClientDir: '../../queryClient',

0 commit comments

Comments
 (0)