Redirect LoginPage after logging in
This commit is contained in:
parent
d7ca4d3be1
commit
ab02089433
|
@ -1,11 +1,19 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
|
import { Redirect } from 'react-router-dom';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
import LoginForm from './login_form';
|
import LoginForm from './login_form';
|
||||||
|
|
||||||
export default @connect()
|
const mapStateToProps = state => ({
|
||||||
|
me: state.get('me'),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default @connect(mapStateToProps)
|
||||||
class LoginPage extends ImmutablePureComponent {
|
class LoginPage extends ImmutablePureComponent {
|
||||||
render() {
|
render() {
|
||||||
|
const { me } = this.props;
|
||||||
|
if (me) return <Redirect to='/' />;
|
||||||
|
|
||||||
return <LoginForm />
|
return <LoginForm />
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue