Created
March 13, 2017 14:08
-
-
Save diegocasmo/24016343f380243dd9533ed4b0588ba3 to your computer and use it in GitHub Desktop.
A Redux middleware to redirect a user after a TODO has been successfully deleted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {browserHistory} from 'react-router' | |
export const redirectMiddleware = createMiddleware([ | |
{ | |
// Redirect user to index page on successful TODO delete | |
action: TODO__DELETE__SUCCESS, | |
afterHandler: (storeAPI, action) => { | |
browserHistory.replace({pathname: '/'}); | |
} | |
} | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See full blogpost 'Navigation Redirects Through Redux Middleware'