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

27 lines
789 B
JavaScript
Raw Normal View History

import logger from 'services/logger';
2016-03-02 02:06:14 +05:30
import AbstractState from './AbstractState';
import CompleteState from './CompleteState';
import ActivationState from './ActivationState';
2016-05-23 09:20:10 +05:30
import ResendActivationState from './ResendActivationState';
2016-03-02 02:06:14 +05:30
export default class RegisterState extends AbstractState {
enter(context) {
context.navigate('/register');
2016-03-02 02:06:14 +05:30
}
resolve(context, payload) {
context.run('register', payload)
.then(() => context.setState(new CompleteState()))
.catch((err = {}) => err.errors || logger.warn(err));
2016-03-02 02:06:14 +05:30
}
reject(context, payload) {
if (payload.requestEmail) {
context.setState(new ResendActivationState());
} else {
context.setState(new ActivationState());
}
2016-03-02 02:06:14 +05:30
}
}