How to use NSwag and RTK Query together?

85 Views Asked by At

We currently have NSwag in our build process to generate a TypeScript client for our API which gets bundled into an NPM package and then consumed by the React App. Some devs have expressed interest in using RTK Query, but it looks like you'd need to define each endpoint manually whereas the current NSwag clients are all generated for us. You just import and use them.

Is there a way to generate the NSwag clients in a way that they use RTK Query (like via a base class or interceptor perhaps?) Or, alternatively, is there a way to use the generated service from within RTK Query without too much manual coding?

0

There are 0 best solutions below