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 {
|
2019-11-27 14:33:32 +05:30
|
|
|
enter(context) {
|
|
|
|
const url = context.getRequest().path.includes('/recover-password')
|
|
|
|
? context.getRequest().path
|
|
|
|
: '/recover-password';
|
|
|
|
context.navigate(url);
|
|
|
|
}
|
2016-05-15 02:23:58 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
resolve(context, payload) {
|
|
|
|
context
|
|
|
|
.run('recoverPassword', payload)
|
|
|
|
.then(() => context.setState(new CompleteState()))
|
|
|
|
.catch(
|
|
|
|
(err = {}) =>
|
|
|
|
err.errors || logger.warn('Error recovering password', err),
|
|
|
|
);
|
|
|
|
}
|
2016-05-15 02:23:58 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
goBack(context) {
|
|
|
|
context.setState(new LoginState());
|
|
|
|
}
|
2016-05-15 02:23:58 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
reject(context) {
|
|
|
|
context.run('contactUs');
|
|
|
|
}
|
2016-05-15 02:23:58 +05:30
|
|
|
}
|