diff --git a/.gitignore b/.gitignore index ec43e83..de65953 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,6 @@ docs/gen *.njsproj *.sln *.sw? + +#API codegen files +./src/store/LynxScannerApi.ts diff --git a/openapi-config.ts b/openapi-config.ts new file mode 100644 index 0000000..fe87aa4 --- /dev/null +++ b/openapi-config.ts @@ -0,0 +1,12 @@ +import type { ConfigFile } from '@rtk-query/codegen-openapi' + +const config: ConfigFile = { + schemaFile: './openapi.yaml', + apiFile: './src/store/emptyApi.ts', + apiImport: 'emptySplitApi', + outputFile: './src/store/LynxScannerApi.ts', + exportName: 'LynxScannerApi', + hooks: true, +} + +export default config diff --git a/src/store/emptyApi.ts b/src/store/emptyApi.ts new file mode 100644 index 0000000..ab51dab --- /dev/null +++ b/src/store/emptyApi.ts @@ -0,0 +1,8 @@ +// Or from '@reduxjs/toolkit/query' if not using the auto-generated hooks +import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react' + +// initialize an empty api service that we'll inject endpoints into later as needed +export const emptySplitApi = createApi({ + baseQuery: fetchBaseQuery({ baseUrl: '/' }), + endpoints: () => ({}) +})