I have a react application and i'm dispatching below async action
#landingScreen.js
useEffect(() => {
dispatch(updateRestoreProgress(isAuthenticated, restoringProgressCompleted, mail, currentlyRestoringCount));
}, [isAuthenticated]);
and in my action.js
# action.js
export const updateRestoreProgress = ( isAuthenticated, restoringProgressCompleted, mail, currentlyRestoringCount) => {
if (isAuthenticated && !restoringProgressCompleted) {
return async (dispatch) => {
... async calls
... dispatch(methods)
...
}
}
// here I need to return and empty action to avoid the console error
}
When i run the above code It's working when the condition "isAuthenticated && !restoringProgressCompleted" becomes true. But if not, I get an error like below,
Uncaught (in promise) TypeError: Cannot read property 'type' of undefined
suggest a solution pls