react-query-lightbase-codegen 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -483,7 +483,6 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
|
|
|
483
483
|
}
|
|
484
484
|
if (!requestBodyComponent && !paramsInPath.length && queryParam && !headerParam) {
|
|
485
485
|
output += `
|
|
486
|
-
// USE AS EXAMPLE
|
|
487
486
|
type ${componentName}Variables = {
|
|
488
487
|
${queryParamsType}
|
|
489
488
|
}
|
|
@@ -492,7 +491,7 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
|
|
|
492
491
|
use${componentName}Query.queryKey = (params: ${componentName}Variables ): QueryKey => [...use${componentName}Query.baseKey(), params];
|
|
493
492
|
use${componentName}Query.fetch = async (props: ${componentName}Variables) => {
|
|
494
493
|
const params = queryString.stringify({${queryParams
|
|
495
|
-
.map((param) =>
|
|
494
|
+
.map((param) => `"${param.name}": props["${param.name}"]`)
|
|
496
495
|
.join(',')}});
|
|
497
496
|
const result = await api.${verb}<${genericsTypes}>(\`${route}?\${params}\`)
|
|
498
497
|
return result.data;
|
|
@@ -583,7 +582,6 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
|
|
|
583
582
|
}
|
|
584
583
|
if (!requestBodyComponent && !paramsInPath.length && !queryParam && headerParam) {
|
|
585
584
|
output += `
|
|
586
|
-
// DONE
|
|
587
585
|
type ${componentName}Variables = {
|
|
588
586
|
${headerParam}
|
|
589
587
|
};
|
|
@@ -617,7 +615,6 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
|
|
|
617
615
|
}
|
|
618
616
|
if (!requestBodyComponent && !paramsInPath.length && queryParam && headerParam) {
|
|
619
617
|
output += `
|
|
620
|
-
// DONE
|
|
621
618
|
type ${componentName}Variables = {
|
|
622
619
|
${headerParam}
|
|
623
620
|
${queryParamsType};
|
|
@@ -630,7 +627,6 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
|
|
|
630
627
|
const headers = {
|
|
631
628
|
${headerParams.map((param) => `"${param.name}": data["${param.name}"]`).join(',')}
|
|
632
629
|
}
|
|
633
|
-
// HIHI
|
|
634
630
|
const result = await api.${verb}<${genericsTypes}>(\`${route}?\${params}\`, {headers})
|
|
635
631
|
return result.data;
|
|
636
632
|
}
|
|
@@ -658,7 +654,6 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
|
|
|
658
654
|
}
|
|
659
655
|
if (requestBodyComponent && !paramsInPath.length && !queryParam && headerParam) {
|
|
660
656
|
output += `
|
|
661
|
-
// HEHEHEHEHE
|
|
662
657
|
type ${componentName}Variables = ${requestBodyComponent} & {
|
|
663
658
|
${headerParam}
|
|
664
659
|
};
|
|
@@ -463,7 +463,6 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
|
|
|
463
463
|
}
|
|
464
464
|
if (!requestBodyComponent && !paramsInPath.length && queryParam && !headerParam) {
|
|
465
465
|
output += `
|
|
466
|
-
// USE AS EXAMPLE
|
|
467
466
|
type ${componentName}Variables = {
|
|
468
467
|
${queryParamsType}
|
|
469
468
|
}
|
|
@@ -472,7 +471,7 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
|
|
|
472
471
|
use${componentName}Query.queryKey = (params: ${componentName}Variables ): QueryKey => [...use${componentName}Query.baseKey(), params];
|
|
473
472
|
use${componentName}Query.fetch = async (props: ${componentName}Variables) => {
|
|
474
473
|
const params = queryString.stringify({${queryParams
|
|
475
|
-
.map((param) =>
|
|
474
|
+
.map((param) => `"${param.name}": props["${param.name}"]`)
|
|
476
475
|
.join(',')}});
|
|
477
476
|
const result = await api.${verb}<${genericsTypes}>(\`${route}?\${params}\`)
|
|
478
477
|
return result.data;
|
|
@@ -563,7 +562,6 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
|
|
|
563
562
|
}
|
|
564
563
|
if (!requestBodyComponent && !paramsInPath.length && !queryParam && headerParam) {
|
|
565
564
|
output += `
|
|
566
|
-
// DONE
|
|
567
565
|
type ${componentName}Variables = {
|
|
568
566
|
${headerParam}
|
|
569
567
|
};
|
|
@@ -597,7 +595,6 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
|
|
|
597
595
|
}
|
|
598
596
|
if (!requestBodyComponent && !paramsInPath.length && queryParam && headerParam) {
|
|
599
597
|
output += `
|
|
600
|
-
// DONE
|
|
601
598
|
type ${componentName}Variables = {
|
|
602
599
|
${headerParam}
|
|
603
600
|
${queryParamsType};
|
|
@@ -610,7 +607,6 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
|
|
|
610
607
|
const headers = {
|
|
611
608
|
${headerParams.map((param) => `"${param.name}": data["${param.name}"]`).join(',')}
|
|
612
609
|
}
|
|
613
|
-
// HIHI
|
|
614
610
|
const result = await api.${verb}<${genericsTypes}>(\`${route}?\${params}\`, {headers})
|
|
615
611
|
return result.data;
|
|
616
612
|
}
|
|
@@ -638,7 +634,6 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
|
|
|
638
634
|
}
|
|
639
635
|
if (requestBodyComponent && !paramsInPath.length && !queryParam && headerParam) {
|
|
640
636
|
output += `
|
|
641
|
-
// HEHEHEHEHE
|
|
642
637
|
type ${componentName}Variables = ${requestBodyComponent} & {
|
|
643
638
|
${headerParam}
|
|
644
639
|
};
|