Closed sentoc closed 1 week ago
extra
comes from the global store config for the thunk
middleware, so it's not something you'd be able to pass in at a hook call site.
You'd need to pass that in as one of the actual arguments to the hook (and possibly pass that value along to the base query as well - not sure).
Background
I'd like to determine
baseUrl
when make the actual api call.by reading https://github.com/reduxjs/redux-toolkit/issues/1335, I know we can use
extra
field, something like:Question
Its ok to define apis as above, but I cannot find a way to set the
extra
when use query hooks, below code is what I want, but does not work, any suggestion is appreciated!More
region
to all my endpoints, even though those endpoints does not care about the parameter.// unexpected, because parameter
region
is not part of the api. const postInSgRegion = getPostById({postId: 12, region: 'sg'})extra
at middleware level globally, not per hook call.