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-05-23 09:20:10 +05:30
|
|
|
if (user.isActive && !user.isGuest) {
|
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)
|
|
|
|
.then(() => context.setState(new CompleteState()));
|
|
|
|
}
|
|
|
|
|
|
|
|
goBack(context) {
|
2016-05-23 09:20:10 +05:30
|
|
|
const {user} = context.getState();
|
|
|
|
|
|
|
|
if (user.isGuest) {
|
|
|
|
context.setState(new RegisterState());
|
|
|
|
} else {
|
|
|
|
context.setState(new ActivationState());
|
|
|
|
}
|
2016-05-23 00:28:43 +05:30
|
|
|
}
|
|
|
|
}
|