Sharing endpoints between different createApi services #1486
-
Hi there, We have been using RTK Query for a while now (enjoying it) but have been unable to solve a design issue. We have the following setup (Lerna packages):
We would like to achieve a setup in which apps can import needed endpoints. For example, we would like to create an ApiSlice for use in App A that includes Service A and Service C and another ApiSlice for use in App B that includes Service A and Service B. Thus far we have been unable to figure out how to do this, the primary issue is the typing. Something like the following works
The issue with the above and all other approaches we have tried (including passing the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The answer is the same one as always: ^^ Use one api. Make an empty api one in your main file, use that in all your applications. Then use our documented code splitting approach to have multiple extra files for your endpoints. Only the endpoints in these files you import in your final apps will make it into those apps. |
Beta Was this translation helpful? Give feedback.
The answer is the same one as always: ^^
Use one api.
Make an empty api one in your main file, use that in all your applications. Then use our documented code splitting approach to have multiple extra files for your endpoints.
Only the endpoints in these files you import in your final apps will make it into those apps.