I have a /login
route which currently just renders the AccountsUIWrapper
component. Upon logging in (or if this route is somehow navigated to while logged in), I’d like to re-route the user the their dashboard.
I had assumed something like below would work:
const onEnterLogin = () => {
if (Meteor.user()) {
browserHistory.push('/dashboard')
}
}
<Route path="login" component={Login} onEnter={onEnterLogin}/>
though upon login the user is not redirected. Using react-router, how can I re-route the user automatically once they’ve logged in?
EDIT: I assume I could do this by logging in programmatically instead of using AccountsUIWrapper
and using browserHistory.push()
on success. However, I’d like a way to do this using AccountsUIWrapper
.