react-query-lightbase-codegen 0.0.18 → 0.0.19

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.
@@ -396,6 +396,7 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
396
396
  const headerParam = headerType && headerType !== 'void' ? `${headerType};` : '';
397
397
  const queryParam = queryParamsType && queryParamsType !== 'void' ? `${queryParamsType}` : '';
398
398
  const requestBodyComponent = requestBodyTypes && requestBodyTypes !== 'void' ? `${requestBodyTypes}` : '';
399
+ let AxiosErrorType = true ? 'AxiosError<AxiosErrorType | unknown>' : `AxiosError<any>`;
399
400
  // QUERIES
400
401
  if (!requestBodyComponent && paramsInPath.length && !queryParam && !headerParam) {
401
402
  output += `
@@ -424,7 +425,7 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
424
425
  queryClient.invalidateQueries<${componentName}Response>(use${componentName}Query.queryKey(params));
425
426
 
426
427
  type ${componentName}QueryProps<T = ${componentName}Response> = ${componentName}Variables & {
427
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
428
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
428
429
  }
429
430
  export function use${componentName}Query<T = ${componentName}Response>({ options = {}, ...props }: ${componentName}QueryProps<T>) {
430
431
  return useQuery(use${componentName}Query.queryKey(props), async () => use${componentName}Query.fetch(props),
@@ -432,7 +433,7 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
432
433
  );}
433
434
 
434
435
  type ${componentName}MutationProps<T> = {
435
- options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>
436
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>
436
437
  }
437
438
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
438
439
  return useMutation(async (data) => use${componentName}Query.fetch(data),
@@ -470,14 +471,14 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
470
471
  queryClient.invalidateQueries<${componentName}Response>(use${componentName}Query.queryKey(params));
471
472
 
472
473
  type ${componentName}QueryProps<T = ${componentName}Response> ${componentName}Variables & {
473
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
474
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
474
475
  }
475
476
  export function use${componentName}Query<T = ${componentName}Response>({ options = {}, ...props }: ${componentName}QueryProps<T>) {
476
477
  return useQuery(use${componentName}Query.queryKey(props), async () => use${componentName}Query.fetch(props), { enabled: !!props.${paramsInPath.join(' && !!props.')}, ...options }
477
478
  );}
478
479
 
479
480
  type ${componentName}MutationProps<T> = {
480
- options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>
481
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>
481
482
  }
482
483
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
483
484
  return useMutation(async (data) => use${componentName}Query.fetch(data),
@@ -508,14 +509,14 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
508
509
 
509
510
 
510
511
  type ${componentName}QueryProps<T = ${componentName}Response> = {
511
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
512
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
512
513
  }
513
514
  export function use${componentName}Query<T = ${componentName}Response>(props?: ${componentName}QueryProps<T>) {
514
515
  return useQuery(use${componentName}Query.queryKey(), use${componentName}Query.fetch, props?.options
515
516
  );}
516
517
 
517
518
  type ${componentName}MutationProps<T> = {
518
- options?: UseMutationOptions<${componentName}Response, AxiosError, void, T>
519
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, void, T>
519
520
  }
520
521
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
521
522
  return useMutation(async () => use${componentName}Query.fetch(),
@@ -552,12 +553,12 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
552
553
  use${componentName}Query.invalidate = (params: ${componentName}Variables) =>
553
554
  queryClient.invalidateQueries<${componentName}Response>(use${componentName}Query.queryKey(params));
554
555
 
555
- export function use${componentName}Query<T = ${componentName}Response>({ options = {}, ...props }: ${componentName}Variables & { options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>}) {
556
+ export function use${componentName}Query<T = ${componentName}Response>({ options = {}, ...props }: ${componentName}Variables & { options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>}) {
556
557
  return useQuery(use${componentName}Query.queryKey(props), async () => use${componentName}Query.fetch(props),
557
558
  { enabled: !!props${queryParams.map((param) => `["${param.name}"]`).join(' && !!props')}, ...options }
558
559
  );}
559
560
 
560
- export function use${componentName}Mutation<T = ${componentName}Response>(props?: { options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>}) {
561
+ export function use${componentName}Mutation<T = ${componentName}Response>(props?: { options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>}) {
561
562
  return useMutation(async (data) => use${componentName}Query.fetch(data),
562
563
  props?.options
563
564
  )};
@@ -590,14 +591,14 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
590
591
 
591
592
 
592
593
  type ${componentName}QueryProps<T = ${componentName}Response> = ${componentName}Variables & {
593
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
594
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
594
595
  }
595
596
  export function use${componentName}Query<T = ${componentName}Response>({ options = {}, ...body }: ${componentName}QueryProps<T>) {
596
597
  return useQuery(use${componentName}Query.queryKey(body), async () => use${componentName}Query.fetch(body), options
597
598
  );}
598
599
 
599
600
  type ${componentName}MutationProps<T> = {
600
- options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>
601
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>
601
602
  }
602
603
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
603
604
  return useMutation(async (body) => use${componentName}Query.fetch(body),
@@ -610,7 +611,7 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
610
611
  type ${componentName}Variables = ${requestBodyComponent} & {${paramsTypes}}
611
612
 
612
613
  type ${componentName}QueryProps<T = ${componentName}Response> = ${componentName}Variables & {
613
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
614
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
614
615
  }
615
616
 
616
617
  use${componentName}Query.fetch = async (props: ${componentName}Variables) => {
@@ -639,7 +640,7 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
639
640
  );}
640
641
 
641
642
  type ${componentName}MutationProps<T> = {
642
- options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>
643
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>
643
644
  }
644
645
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
645
646
  return useMutation(async (body) => use${componentName}Query.fetch(body),
@@ -654,7 +655,7 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
654
655
  }
655
656
 
656
657
  type ${componentName}QueryProps<T = ${componentName}Response> = ${componentName}Variables & {
657
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
658
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
658
659
  }
659
660
 
660
661
  use${componentName}Query.fetch = async (props: ${componentName}Variables) => {
@@ -691,7 +692,7 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
691
692
 
692
693
 
693
694
  type ${componentName}MutationProps<T> = {
694
- options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>
695
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>
695
696
  }
696
697
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
697
698
  return useMutation(async (body) => use${componentName}Query.fetch(body),
@@ -742,7 +743,7 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
742
743
 
743
744
 
744
745
  type ${componentName}QueryProps<T = ${componentName}Response> = ${componentName}Variables & {
745
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
746
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
746
747
  }
747
748
  export function use${componentName}Query<T = ${componentName}Response>({ options = {}, ...props }: ${componentName}QueryProps<T>) {
748
749
  return useQuery(use${componentName}Query.queryKey(props), async () => use${componentName}Query.fetch(props),
@@ -752,7 +753,7 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
752
753
 
753
754
 
754
755
  type ${componentName}MutationProps<T> = {
755
- options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>
756
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>
756
757
  }
757
758
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
758
759
  return useMutation(async (data) => use${componentName}Query.fetch(data),
@@ -794,7 +795,7 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
794
795
  queryClient.invalidateQueries<${componentName}Response>(use${componentName}Query.queryKey(params));
795
796
 
796
797
  type ${componentName}QueryProps<T = ${componentName}Response> = ${componentName}Variables & {
797
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
798
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
798
799
  }
799
800
  export function use${componentName}Query<T = ${componentName}Response>({ options = {}, ...props }: ${componentName}QueryProps<T>) {
800
801
  return useQuery(use${componentName}Query.queryKey(props), async () => use${componentName}Query.fetch(props),
@@ -804,7 +805,7 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
804
805
  );}
805
806
 
806
807
  type ${componentName}MutationProps<T> = {
807
- options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>
808
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>
808
809
  }
809
810
 
810
811
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
@@ -844,7 +845,7 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
844
845
  queryClient.invalidateQueries<${componentName}Response>(use${componentName}Query.queryKey(params));
845
846
 
846
847
  type ${componentName}QueryProps<T = ${componentName}Response> = ${componentName}Variables & {
847
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
848
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
848
849
  }
849
850
  export function use${componentName}Query<T = ${componentName}Response>({ options = {}, ...body }: ${componentName}QueryProps<T>) {
850
851
  return useQuery(use${componentName}Query.queryKey(body), async () => use${componentName}Query.fetch(body),{ enabled: !!body${headerParams
@@ -854,7 +855,7 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
854
855
 
855
856
 
856
857
  type ${componentName}MutationProps<T> = {
857
- options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>
858
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>
858
859
  }
859
860
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
860
861
  return useMutation(async (body) => use${componentName}Query.fetch(body),
@@ -908,7 +909,7 @@ const importOpenApi = async ({ data, format, apiDirectory, queryClientDir, heade
908
909
 
909
910
  import queryString from 'query-string';
910
911
  import {AxiosError} from 'axios';
911
- import { api } from '${apiDirectory}';
912
+ import { api, AxiosErrorType } from '${apiDirectory}';
912
913
  import { queryClient } from '${queryClientDir}';
913
914
 
914
915
  // SCEHMAS
@@ -376,6 +376,7 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
376
376
  const headerParam = headerType && headerType !== 'void' ? `${headerType};` : '';
377
377
  const queryParam = queryParamsType && queryParamsType !== 'void' ? `${queryParamsType}` : '';
378
378
  const requestBodyComponent = requestBodyTypes && requestBodyTypes !== 'void' ? `${requestBodyTypes}` : '';
379
+ let AxiosErrorType = true ? 'AxiosError<AxiosErrorType | unknown>' : `AxiosError<any>`;
379
380
  // QUERIES
380
381
  if (!requestBodyComponent && paramsInPath.length && !queryParam && !headerParam) {
381
382
  output += `
@@ -404,7 +405,7 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
404
405
  queryClient.invalidateQueries<${componentName}Response>(use${componentName}Query.queryKey(params));
405
406
 
406
407
  type ${componentName}QueryProps<T = ${componentName}Response> = ${componentName}Variables & {
407
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
408
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
408
409
  }
409
410
  export function use${componentName}Query<T = ${componentName}Response>({ options = {}, ...props }: ${componentName}QueryProps<T>) {
410
411
  return useQuery(use${componentName}Query.queryKey(props), async () => use${componentName}Query.fetch(props),
@@ -412,7 +413,7 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
412
413
  );}
413
414
 
414
415
  type ${componentName}MutationProps<T> = {
415
- options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>
416
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>
416
417
  }
417
418
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
418
419
  return useMutation(async (data) => use${componentName}Query.fetch(data),
@@ -450,14 +451,14 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
450
451
  queryClient.invalidateQueries<${componentName}Response>(use${componentName}Query.queryKey(params));
451
452
 
452
453
  type ${componentName}QueryProps<T = ${componentName}Response> ${componentName}Variables & {
453
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
454
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
454
455
  }
455
456
  export function use${componentName}Query<T = ${componentName}Response>({ options = {}, ...props }: ${componentName}QueryProps<T>) {
456
457
  return useQuery(use${componentName}Query.queryKey(props), async () => use${componentName}Query.fetch(props), { enabled: !!props.${paramsInPath.join(' && !!props.')}, ...options }
457
458
  );}
458
459
 
459
460
  type ${componentName}MutationProps<T> = {
460
- options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>
461
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>
461
462
  }
462
463
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
463
464
  return useMutation(async (data) => use${componentName}Query.fetch(data),
@@ -488,14 +489,14 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
488
489
 
489
490
 
490
491
  type ${componentName}QueryProps<T = ${componentName}Response> = {
491
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
492
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
492
493
  }
493
494
  export function use${componentName}Query<T = ${componentName}Response>(props?: ${componentName}QueryProps<T>) {
494
495
  return useQuery(use${componentName}Query.queryKey(), use${componentName}Query.fetch, props?.options
495
496
  );}
496
497
 
497
498
  type ${componentName}MutationProps<T> = {
498
- options?: UseMutationOptions<${componentName}Response, AxiosError, void, T>
499
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, void, T>
499
500
  }
500
501
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
501
502
  return useMutation(async () => use${componentName}Query.fetch(),
@@ -532,12 +533,12 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
532
533
  use${componentName}Query.invalidate = (params: ${componentName}Variables) =>
533
534
  queryClient.invalidateQueries<${componentName}Response>(use${componentName}Query.queryKey(params));
534
535
 
535
- export function use${componentName}Query<T = ${componentName}Response>({ options = {}, ...props }: ${componentName}Variables & { options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>}) {
536
+ export function use${componentName}Query<T = ${componentName}Response>({ options = {}, ...props }: ${componentName}Variables & { options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>}) {
536
537
  return useQuery(use${componentName}Query.queryKey(props), async () => use${componentName}Query.fetch(props),
537
538
  { enabled: !!props${queryParams.map((param) => `["${param.name}"]`).join(' && !!props')}, ...options }
538
539
  );}
539
540
 
540
- export function use${componentName}Mutation<T = ${componentName}Response>(props?: { options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>}) {
541
+ export function use${componentName}Mutation<T = ${componentName}Response>(props?: { options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>}) {
541
542
  return useMutation(async (data) => use${componentName}Query.fetch(data),
542
543
  props?.options
543
544
  )};
@@ -570,14 +571,14 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
570
571
 
571
572
 
572
573
  type ${componentName}QueryProps<T = ${componentName}Response> = ${componentName}Variables & {
573
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
574
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
574
575
  }
575
576
  export function use${componentName}Query<T = ${componentName}Response>({ options = {}, ...body }: ${componentName}QueryProps<T>) {
576
577
  return useQuery(use${componentName}Query.queryKey(body), async () => use${componentName}Query.fetch(body), options
577
578
  );}
578
579
 
579
580
  type ${componentName}MutationProps<T> = {
580
- options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>
581
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>
581
582
  }
582
583
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
583
584
  return useMutation(async (body) => use${componentName}Query.fetch(body),
@@ -590,7 +591,7 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
590
591
  type ${componentName}Variables = ${requestBodyComponent} & {${paramsTypes}}
591
592
 
592
593
  type ${componentName}QueryProps<T = ${componentName}Response> = ${componentName}Variables & {
593
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
594
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
594
595
  }
595
596
 
596
597
  use${componentName}Query.fetch = async (props: ${componentName}Variables) => {
@@ -619,7 +620,7 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
619
620
  );}
620
621
 
621
622
  type ${componentName}MutationProps<T> = {
622
- options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>
623
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>
623
624
  }
624
625
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
625
626
  return useMutation(async (body) => use${componentName}Query.fetch(body),
@@ -634,7 +635,7 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
634
635
  }
635
636
 
636
637
  type ${componentName}QueryProps<T = ${componentName}Response> = ${componentName}Variables & {
637
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
638
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
638
639
  }
639
640
 
640
641
  use${componentName}Query.fetch = async (props: ${componentName}Variables) => {
@@ -671,7 +672,7 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
671
672
 
672
673
 
673
674
  type ${componentName}MutationProps<T> = {
674
- options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>
675
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>
675
676
  }
676
677
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
677
678
  return useMutation(async (body) => use${componentName}Query.fetch(body),
@@ -722,7 +723,7 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
722
723
 
723
724
 
724
725
  type ${componentName}QueryProps<T = ${componentName}Response> = ${componentName}Variables & {
725
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
726
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
726
727
  }
727
728
  export function use${componentName}Query<T = ${componentName}Response>({ options = {}, ...props }: ${componentName}QueryProps<T>) {
728
729
  return useQuery(use${componentName}Query.queryKey(props), async () => use${componentName}Query.fetch(props),
@@ -732,7 +733,7 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
732
733
 
733
734
 
734
735
  type ${componentName}MutationProps<T> = {
735
- options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>
736
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>
736
737
  }
737
738
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
738
739
  return useMutation(async (data) => use${componentName}Query.fetch(data),
@@ -774,7 +775,7 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
774
775
  queryClient.invalidateQueries<${componentName}Response>(use${componentName}Query.queryKey(params));
775
776
 
776
777
  type ${componentName}QueryProps<T = ${componentName}Response> = ${componentName}Variables & {
777
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
778
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
778
779
  }
779
780
  export function use${componentName}Query<T = ${componentName}Response>({ options = {}, ...props }: ${componentName}QueryProps<T>) {
780
781
  return useQuery(use${componentName}Query.queryKey(props), async () => use${componentName}Query.fetch(props),
@@ -784,7 +785,7 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
784
785
  );}
785
786
 
786
787
  type ${componentName}MutationProps<T> = {
787
- options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>
788
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>
788
789
  }
789
790
 
790
791
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
@@ -824,7 +825,7 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
824
825
  queryClient.invalidateQueries<${componentName}Response>(use${componentName}Query.queryKey(params));
825
826
 
826
827
  type ${componentName}QueryProps<T = ${componentName}Response> = ${componentName}Variables & {
827
- options?: UseQueryOptions<${componentName}Response, AxiosError, T, any>
828
+ options?: UseQueryOptions<${componentName}Response, ${AxiosErrorType}, T, any>
828
829
  }
829
830
  export function use${componentName}Query<T = ${componentName}Response>({ options = {}, ...body }: ${componentName}QueryProps<T>) {
830
831
  return useQuery(use${componentName}Query.queryKey(body), async () => use${componentName}Query.fetch(body),{ enabled: !!body${headerParams
@@ -834,7 +835,7 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
834
835
 
835
836
 
836
837
  type ${componentName}MutationProps<T> = {
837
- options?: UseMutationOptions<${componentName}Response, AxiosError, ${componentName}Variables, T>
838
+ options?: UseMutationOptions<${componentName}Response, ${AxiosErrorType}, ${componentName}Variables, T>
838
839
  }
839
840
  export function use${componentName}Mutation<T = ${componentName}Response>(props?: ${componentName}MutationProps<T>) {
840
841
  return useMutation(async (body) => use${componentName}Query.fetch(body),
@@ -887,7 +888,7 @@ export const importOpenApi = async ({ data, format, apiDirectory, queryClientDir
887
888
 
888
889
  import queryString from 'query-string';
889
890
  import {AxiosError} from 'axios';
890
- import { api } from '${apiDirectory}';
891
+ import { api, AxiosErrorType } from '${apiDirectory}';
891
892
  import { queryClient } from '${queryClientDir}';
892
893
 
893
894
  // SCEHMAS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-query-lightbase-codegen",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "license": "MIT",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",