-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Description
I tried to use the component with React v4 router, but it doesn't work, because BrowserHistory is no longer available, so the require doesn't work:
In helpers.js
try { browserHistory = require('react-router').browserHistory } catch(e) {}
According to the React Router doco, you can access props.history.push(), but there is no reference to the route available to do it with...
I did work out a way using <Redirect>, by making use of the hook on the component:
<Accounts.ui.LoginForm
onSignedInHook={ this.onSignedIn }/>
and updating the state in the callback:
onSignedIn(event) {
console.log('user signed in ',this.state);
this.setState({loggedIn: true});
}
And finally using the state to do a redirect
render(){
if (this.state.loggedIn) {
return <Redirect push to="/wizard" />
} else {
I'm not sure if there is a better way to do this
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels