Is it feasible to trigger an action from a different reducer within the API Slice
of Redux RTK? Let's say I have this scenario:
getSomething: builder.query<SomeProps, void>({
query: () => ({
url: "...",
headers: {
'Content-Type': 'application/json',
}
}),
Could I incorporate something like onSuccess
in it (assuming that getSomething()
yields a 200
or any successful response)?
getSomething: builder.query<SomeProps, void>({
query: () => ({
url: "...",
headers: {
'Content-Type': 'application/json',
}
}),
onSuccess: (response: SomeProps, {dispatch}) => {
dispatch(someActionFromAnotherReducer(response))
}