accounts-frontend/src/services/authFlow/ResendActivationState.js

34 lines
1020 B
JavaScript
Raw Normal View History

// @flow
2018-05-03 10:45:09 +05:30
import type { AuthContext } from 'services/authFlow';
import logger from 'services/logger';
import AbstractState from './AbstractState';
import ActivationState from './ActivationState';
2016-05-23 09:20:10 +05:30
import RegisterState from './RegisterState';
export default class ResendActivationState extends AbstractState {
enter(context: AuthContext) {
context.navigate('/resend-activation');
}
resolve(context: AuthContext, payload: Object) {
context.run('resendActivation', payload)
.then(() => context.setState(new ActivationState()))
2017-03-02 11:28:33 +05:30
.catch((err = {}) =>
err.errors || logger.warn('Error resending activation', err)
);
}
reject(context: AuthContext) {
context.setState(new ActivationState());
}
goBack(context: AuthContext) {
if (context.prevState instanceof RegisterState) {
2016-05-23 09:20:10 +05:30
context.setState(new RegisterState());
} else {
context.setState(new ActivationState());
}
}
}