2016-12-07 02:38:51 +05:30
|
|
|
import logger from 'services/logger';
|
|
|
|
|
2016-05-15 02:23:58 +05:30
|
|
|
import AbstractState from './AbstractState';
|
|
|
|
import LoginState from './LoginState';
|
|
|
|
import CompleteState from './CompleteState';
|
|
|
|
|
|
|
|
export default class RecoverPasswordState extends AbstractState {
|
|
|
|
enter(context) {
|
2017-04-19 10:41:05 +05:30
|
|
|
const url = context.getRequest().path.includes('/recover-password')
|
|
|
|
? context.getRequest().path
|
|
|
|
: '/recover-password';
|
|
|
|
context.navigate(url);
|
2016-05-15 02:23:58 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
resolve(context, payload) {
|
|
|
|
context.run('recoverPassword', payload)
|
2016-12-07 02:38:51 +05:30
|
|
|
.then(() => context.setState(new CompleteState()))
|
2017-03-02 11:28:33 +05:30
|
|
|
.catch((err = {}) =>
|
|
|
|
err.errors || logger.warn('Error recovering password', err)
|
|
|
|
);
|
2016-05-15 02:23:58 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
goBack(context) {
|
|
|
|
context.setState(new LoginState());
|
|
|
|
}
|
|
|
|
|
|
|
|
reject(context) {
|
2017-02-24 02:37:05 +05:30
|
|
|
context.run('contactUs');
|
2016-05-15 02:23:58 +05:30
|
|
|
}
|
|
|
|
}
|