How to Chain API calls with useDispatch
EdgarKisman opened this issue · 0 comments
EdgarKisman commented
Hi guys,
hope someone can help me.
Example:
I have two api calls which need to be chained. Call B should be fired after Call A received a Response.
Call A and Call B are Functions which i use together with useDispatch()
e.g.
const callA = useDispatch(callAFunction)
const callB = useDispatch(callBFunction)
I tried to do something like callA().then(() => callB) but this is not working.
This is how a function looks like:
export const callA= (state: State, dispatch: Dispatch): void => { fetchMe().subscribe(response => setGlobal(response)) }