-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed as not planned
Description
I saw #1126 and #1518, they are both about async thunks, and probably can be solved with workaround about how reducer is exported (didn't try it myself).
I need AppState in RTQ endpoint definition, like this:
export const MyApi = createApi({
baseQuery: ...,
endpoints: builder => ({
whatever: builder.query<..., void>({
queryFn: (_, { getState }, opts, baseQuery) => {
const state = getState() as AppState
return baseQuery(`users/${state.user.id}/whatever`)
},
}),
}),
})I don't even have initial state to try this approach.
What can I do in this case, aside of casting state into any?
Obviously, in this simple example I can rethink my api and just pass user id as explicit parameter. But in general case, is it possible to solve?
thorn0, gilangmlr and gjuoun
Metadata
Metadata
Assignees
Labels
No labels