mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-13 16:58:59 +05:30
32 lines
883 B
JavaScript
32 lines
883 B
JavaScript
|
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) {
|
||
|
const url = routing.location.pathname.indexOf('/recover-password') === 0
|
||
|
? 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');
|
||
|
}
|
||
|
}
|