Added redirect on login

This commit is contained in:
2019-05-11 13:05:34 +10:00
parent 676cd45589
commit b2b0f628bd
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -136,7 +136,7 @@ class Home extends React.Component {
return (
<div className='sidePanel'>
<SignupPanel />
<Login />
<Login onSubmit={() => {this.props.history.push('/profile');}} />
<RecoverPanel />
</div>
);
+4
View File
@@ -60,6 +60,10 @@ class Login extends React.Component {
if (xhr.status === 200) {
let json = JSON.parse(xhr.responseText);
this.props.login(json.id, json.email, json.username, json.token);
if (this.props.onSubmit) {
this.props.onSubmit();
}
}
else if (xhr.status === 400) {