2016-12-07 02:38:51 +05:30
|
|
|
import logger from 'services/logger';
|
|
|
|
|
2016-03-02 02:06:14 +05:30
|
|
|
import AbstractState from './AbstractState';
|
|
|
|
import CompleteState from './CompleteState';
|
2016-07-24 14:02:54 +05:30
|
|
|
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) {
|
2017-01-31 11:35:36 +05:30
|
|
|
context.navigate('/register');
|
2016-03-02 02:06:14 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
resolve(context, payload) {
|
|
|
|
context.run('register', payload)
|
2016-12-07 02:38:51 +05:30
|
|
|
.then(() => context.setState(new CompleteState()))
|
2017-03-02 11:28:33 +05:30
|
|
|
.catch((err = {}) =>
|
|
|
|
err.errors || logger.warn('Error registering', err)
|
|
|
|
);
|
2016-03-02 02:06:14 +05:30
|
|
|
}
|
|
|
|
|
2016-07-24 14:02:54 +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
|
|
|
}
|
|
|
|
}
|