-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
re-fire the same asyncAction that failed #42
Comments
Word of advice - wrap you code example in triple backticks
|
Will this work? export const onUnauthorizedResponse = (action$, state$) =>
action$.pipe(
switchMap(action => {
// don't destruct immediately, get the full action, and return it later?
const {type, payload} = action
if (type.endsWith('ASYNC_FAILURE') && payload?.response?.status === 401) {
if(userFireAccessToken(state$.value) && localStorage.getItem('accessToken') !== userFireAccessToken(state$.value)){
localStorage.setItem('accessToken', userFireAccessToken(state$.value));
return [action];
}
}
return [];
}),
); |
No... you are trying to fire an action of type ASYNC_FAILURE with its payload. |
Here is my solution for this problem. Epic
Epic
Action
Reducer
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
First of all, Thank you for this great package!
Now, My problem is: I need to re-fire the same asyncAction that failed (with the same payload, after changing the local storage accessToken value).
How can i do it with out adding it as a metaData to each action?
*userFireAccessToken is just a selector for the refreshed token.
The text was updated successfully, but these errors were encountered: