2016-05-23 00:28:43 +05:30
|
|
|
import AbstractState from './AbstractState';
|
|
|
|
import CompleteState from './CompleteState';
|
|
|
|
import ActivationState from './ActivationState';
|
2016-05-23 09:20:10 +05:30
|
|
|
import RegisterState from './RegisterState';
|
2016-05-23 00:28:43 +05:30
|
|
|
|
|
|
|
export default class ResendActivationState extends AbstractState {
|
|
|
|
enter(context) {
|
|
|
|
const {user} = context.getState();
|
|
|
|
|
2016-06-05 17:36:14 +05:30
|
|
|
if (user.isActive) {
|
2016-05-23 00:28:43 +05:30
|
|
|
context.setState(new CompleteState());
|
|
|
|
} else {
|
2016-05-23 09:20:10 +05:30
|
|
|
context.navigate('/resend-activation');
|
2016-05-23 00:28:43 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resolve(context, payload) {
|
|
|
|
context.run('resendActivation', payload)
|
2016-06-05 17:36:14 +05:30
|
|
|
.then(() => context.setState(new ActivationState()));
|
2016-05-23 00:28:43 +05:30
|
|
|
}
|
|
|
|
|
2016-07-24 14:02:54 +05:30
|
|
|
reject(context) {
|
|
|
|
context.setState(new ActivationState());
|
|
|
|
}
|
|
|
|
|
2016-05-23 00:28:43 +05:30
|
|
|
goBack(context) {
|
2016-06-05 17:36:14 +05:30
|
|
|
if (context.prevState instanceof RegisterState) {
|
2016-05-23 09:20:10 +05:30
|
|
|
context.setState(new RegisterState());
|
|
|
|
} else {
|
|
|
|
context.setState(new ActivationState());
|
|
|
|
}
|
2016-05-23 00:28:43 +05:30
|
|
|
}
|
|
|
|
}
|