generated from stijnvanhulle/template
-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: example for react-query templates (#842)
* chore: example for react-query templates * fix: bundle require * chore: update docs
- Loading branch information
1 parent
c5e4921
commit e851171
Showing
113 changed files
with
2,616 additions
and
2,427 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@kubb/cli": patch | ||
--- | ||
|
||
correct import with bundle-require |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,11 +21,11 @@ | |
"dependencies": { | ||
"@vercel/analytics": "^1.2.2", | ||
"sitemap": "^7.1.1", | ||
"vitepress": "^1.0.0-rc.44", | ||
"vitepress": "^1.0.0-rc.45", | ||
"vue": "^3.4.21" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.11.24" | ||
"@types/node": "^20.11.25" | ||
}, | ||
"packageManager": "[email protected]", | ||
"engines": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ | |
"@kubb/ts-config": "workspace:*", | ||
"react": "^18.2.0", | ||
"tsup": "^8.0.2", | ||
"typescript": "^5.3.3" | ||
"typescript": "^5.4.2" | ||
}, | ||
"packageManager": "[email protected]", | ||
"engines": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ | |
}, | ||
"devDependencies": { | ||
"@kubb/ts-config": "workspace:*", | ||
"typescript": "^5.3.3" | ||
"typescript": "^5.4.2" | ||
}, | ||
"packageManager": "[email protected]", | ||
"engines": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,13 +26,16 @@ | |
"@kubb/swagger": "workspace:*", | ||
"@kubb/swagger-client": "workspace:*", | ||
"@kubb/swagger-ts": "workspace:*", | ||
"axios": "^1.6.7" | ||
"axios": "^1.6.7", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@kubb/ts-config": "workspace:*", | ||
"react": "^18.2.0", | ||
"@types/react": "^18.2.63", | ||
"@types/react-dom": "^18.2.20", | ||
"tsup": "^8.0.2", | ||
"typescript": "^5.3.3" | ||
"typescript": "^5.4.2" | ||
}, | ||
"packageManager": "[email protected]", | ||
"engines": { | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
export * from './useAddPetHook' | ||
export * from './useCreateUserHook' | ||
export * from './useCreateUsersWithListInputHook' | ||
export * from './useDeleteOrderHook' | ||
export * from './useDeletePetHook' | ||
export * from './useDeleteUserHook' | ||
export * from './useFindPetsByStatusHook' | ||
export * from './useFindPetsByTagsHook' | ||
export * from './useGetInventoryHook' | ||
export * from './useGetOrderByIdHook' | ||
export * from './useGetPetByIdHook' | ||
export * from './useGetUserByNameHook' | ||
export * from './useLoginUserHook' | ||
export * from './useLogoutUserHook' | ||
export * from './usePlaceOrderHook' | ||
export * from './usePlaceOrderPatchHook' | ||
export * from './useUpdatePetHook' | ||
export * from './useUpdatePetWithFormHook' | ||
export * from './useUpdateUserHook' | ||
export * from './useUploadFileHook' | ||
export * from "./useAddPetHook"; | ||
export * from "./useCreateUserHook"; | ||
export * from "./useCreateUsersWithListInputHook"; | ||
export * from "./useDeleteOrderHook"; | ||
export * from "./useDeletePetHook"; | ||
export * from "./useDeleteUserHook"; | ||
export * from "./useFindPetsByStatusHook"; | ||
export * from "./useFindPetsByTagsHook"; | ||
export * from "./useGetInventoryHook"; | ||
export * from "./useGetOrderByIdHook"; | ||
export * from "./useGetPetByIdHook"; | ||
export * from "./useGetUserByNameHook"; | ||
export * from "./useLoginUserHook"; | ||
export * from "./useLogoutUserHook"; | ||
export * from "./usePlaceOrderHook"; | ||
export * from "./usePlaceOrderPatchHook"; | ||
export * from "./useUpdatePetHook"; | ||
export * from "./useUpdatePetWithFormHook"; | ||
export * from "./useUpdateUserHook"; | ||
export * from "./useUploadFileHook"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
import client from '@kubb/swagger-client/client' | ||
import { useMutation } from '@tanstack/react-query' | ||
import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../models/AddPet' | ||
import type { UseMutationOptions } from '@tanstack/react-query' | ||
import client from "@kubb/swagger-client/client"; | ||
import { useMutation } from "@tanstack/react-query"; | ||
import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from "../models/AddPet"; | ||
import type { UseMutationOptions } from "@tanstack/react-query"; | ||
|
||
type AddPetClient = typeof client<AddPetMutationResponse, AddPet405, AddPetMutationRequest> | ||
type AddPetClient = typeof client<AddPetMutationResponse, AddPet405, AddPetMutationRequest>; | ||
type AddPet = { | ||
data: AddPetMutationResponse | ||
error: AddPet405 | ||
request: AddPetMutationRequest | ||
pathParams: never | ||
queryParams: never | ||
headerParams: never | ||
response: AddPetMutationResponse | ||
client: { | ||
parameters: Partial<Parameters<AddPetClient>[0]> | ||
return: Awaited<ReturnType<AddPetClient>> | ||
} | ||
} | ||
data: AddPetMutationResponse; | ||
error: AddPet405; | ||
request: AddPetMutationRequest; | ||
pathParams: never; | ||
queryParams: never; | ||
headerParams: never; | ||
response: AddPetMutationResponse; | ||
client: { | ||
parameters: Partial<Parameters<AddPetClient>[0]>; | ||
return: Awaited<ReturnType<AddPetClient>>; | ||
}; | ||
}; | ||
/** | ||
* @description Add a new pet to the store | ||
* @summary Add a new pet to the store | ||
* @link /pet */ | ||
* @description Add a new pet to the store | ||
* @summary Add a new pet to the store | ||
* @link /pet */ | ||
export function useAddPetHook(options: { | ||
mutation?: UseMutationOptions<AddPet['response'], AddPet['error'], AddPet['request']> | ||
client?: AddPet['client']['parameters'] | ||
mutation?: UseMutationOptions<AddPet["response"], AddPet["error"], AddPet["request"]>; | ||
client?: AddPet["client"]["parameters"]; | ||
} = {}) { | ||
const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} | ||
return useMutation({ | ||
mutationFn: async (data) => { | ||
const res = await client<AddPet['data'], AddPet['error'], AddPet['request']>({ | ||
method: 'post', | ||
url: `/pet`, | ||
data, | ||
...clientOptions, | ||
}) | ||
return res.data | ||
}, | ||
...mutationOptions, | ||
}) | ||
} | ||
const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; | ||
return useMutation({ | ||
mutationFn: async (data) => { | ||
const res = await client<AddPet["data"], AddPet["error"], AddPet["request"]>({ | ||
method: "post", | ||
url: `/pet`, | ||
data, | ||
...clientOptions | ||
}); | ||
return res.data; | ||
}, | ||
...mutationOptions | ||
}); | ||
} |
Oops, something went wrong.