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) {
|
|
|
|
const {user, routing} = context.getState();
|
|
|
|
|
|
|
|
if (user.isGuest) {
|
2016-06-05 17:46:41 +05:30
|
|
|
const url = routing.location.pathname.includes('/recover-password')
|
2016-05-15 02:23:58 +05:30
|
|
|
? routing.location.pathname
|
|
|
|
: '/recover-password';
|
|
|
|
context.navigate(url);
|
|
|
|
} else {
|
|
|
|
context.setState(new CompleteState());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resolve(context, payload) {
|
|
|
|
context.run('recoverPassword', payload)
|
|
|
|
.then(() => context.setState(new CompleteState()));
|
|
|
|
}
|
|
|
|
|
|
|
|
goBack(context) {
|
|
|
|
context.setState(new LoginState());
|
|
|
|
}
|
|
|
|
|
|
|
|
reject(context) {
|
|
|
|
context.navigate('/send-message');
|
|
|
|
}
|
|
|
|
}
|