Fixes redirection upon password recovery

This commit is contained in:
Maxi Redigonda 2018-07-20 17:35:58 -03:00
parent ac5b72f35d
commit e204b1877c
2 changed files with 7 additions and 4 deletions

View File

@ -3,6 +3,7 @@ import _ from 'lodash';
import i18n from 'lib-app/i18n';
import API from 'lib-app/api-call';
import history from 'lib-app/history';
import Widget from 'core-components/widget';
import Form from 'core-components/form';
@ -73,8 +74,8 @@ class MainRecoverPasswordPage extends React.Component {
}).then(this.onPasswordRecovered.bind(this)).catch(this.onPasswordRecoverFail.bind(this));
}
onPasswordRecovered() {
setTimeout(() => {this.props.history.push('/')}, 2000);
onPasswordRecovered(response) {
setTimeout(() => {history.push(response.data.staff ? '/admin' : '/')}, 2000);
this.setState({
recoverStatus: 'valid',
loading: false
@ -89,4 +90,4 @@ class MainRecoverPasswordPage extends React.Component {
}
}
export default MainRecoverPasswordPage;
export default MainRecoverPasswordPage;

View File

@ -77,7 +77,9 @@ module.exports = [
if (data.password.length > 6) {
return {
status: 'success',
data: {}
data: {
staff: true
}
};
} else {
return {