Generating parts of the endpoint definitions #4452
-
Hello, i want to integrate RTK Query in an existing project. The API is fully typed using zod, these types are autogenerated. Now i also want to generate most of the code of RTK Query. so i can easily generate something like this: export const buildApiRTK = () => {
return createApi({
// ....
endpoints: (builder) => ({
TestZodPost: builder.query<RTKTYPES["TestZodPost"]["ResultType"], RTKTYPES["TestZodPost"]["Query"]>({
query: (o) => ({url: path_test_zod(o.args, o.params), method: 'POST'}),
// i want to allow to extend this in a typesafe way
}),
}),
})
}) BUT now i've the problem that i want to generate the code in a way, that you can extend it from the outside. for example i need to make sure that you could inject a any ideas how i can generate the code to allow to extends the i also looked at code splitting but it does not allow to generate parts of the api. i tried to inject inject some kind of configuration to the thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
enhanceEndpoints seems to be the way so solve it. i'll try and reopen the discussion if it doesn't work. |
Beta Was this translation helpful? Give feedback.
enhanceEndpoints seems to be the way so solve it. i'll try and reopen the discussion if it doesn't work.