mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-10-31 07:53:20 +05:30
37 lines
1.0 KiB
JavaScript
37 lines
1.0 KiB
JavaScript
import logger from 'services/logger';
|
|
|
|
import AbstractState from './AbstractState';
|
|
import CompleteState from './CompleteState';
|
|
import ActivationState from './ActivationState';
|
|
import RegisterState from './RegisterState';
|
|
|
|
export default class ResendActivationState extends AbstractState {
|
|
enter(context) {
|
|
const {user} = context.getState();
|
|
|
|
if (user.isActive) {
|
|
context.setState(new CompleteState());
|
|
} else {
|
|
context.navigate('/resend-activation');
|
|
}
|
|
}
|
|
|
|
resolve(context, payload) {
|
|
context.run('resendActivation', payload)
|
|
.then(() => context.setState(new ActivationState()))
|
|
.catch((err = {}) => err.errors || logger.warn(err));
|
|
}
|
|
|
|
reject(context) {
|
|
context.setState(new ActivationState());
|
|
}
|
|
|
|
goBack(context) {
|
|
if (context.prevState instanceof RegisterState) {
|
|
context.setState(new RegisterState());
|
|
} else {
|
|
context.setState(new ActivationState());
|
|
}
|
|
}
|
|
}
|