Closed
Description
Hello,
I recently upgraded from RTK Toolkit 1.9.7, and I noticed that because UMD build artifacts are no longer included, I could not import the FetchBaseQueryArgs
like so:
import { FetchBaseQueryArgs } from '@reduxjs/toolkit/dist/query/fetchBaseQuery';
My use case for this is that I have implemented a custom version of fetchBaseQuery
at my company that dynamically constructs the URL through various customizable callbacks and options to help us target different projects and environments through our microservices. It looks something like this:
export const fetchDynamicBaseQuery = (
fetchBaseQueryArgs: FetchBaseQueryArgs,
options?: DynamicBaseQueryOptions,
): BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, ExtraOptions> => {
return async (args, api, extraOptions) => {
const { baseUrl, ...rest } = fetchBaseQueryArgs;
let finalBaseUrl = baseUrl;
// Doing stuff here...
const rawBaseQuery = fetchBaseQuery({ baseUrl: finalBaseUrl, ...rest });
return rawBaseQuery(args, api, extraOptions);
};
Would it be possible to expose this type again? Also open to alternative ways of doing this, but this approach has worked well so far.
Metadata
Metadata
Assignees
Labels
No labels