Added redirect on login
This commit is contained in:
@@ -136,7 +136,7 @@ class Home extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<div className='sidePanel'>
|
<div className='sidePanel'>
|
||||||
<SignupPanel />
|
<SignupPanel />
|
||||||
<Login />
|
<Login onSubmit={() => {this.props.history.push('/profile');}} />
|
||||||
<RecoverPanel />
|
<RecoverPanel />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -60,6 +60,10 @@ class Login extends React.Component {
|
|||||||
if (xhr.status === 200) {
|
if (xhr.status === 200) {
|
||||||
let json = JSON.parse(xhr.responseText);
|
let json = JSON.parse(xhr.responseText);
|
||||||
this.props.login(json.id, json.email, json.username, json.token);
|
this.props.login(json.id, json.email, json.username, json.token);
|
||||||
|
|
||||||
|
if (this.props.onSubmit) {
|
||||||
|
this.props.onSubmit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (xhr.status === 400) {
|
else if (xhr.status === 400) {
|
||||||
|
|||||||
Reference in New Issue
Block a user