2019-12-08 00:32:00 +05:30
|
|
|
import logger from 'app/services/logger';
|
2016-12-07 02:38:51 +05:30
|
|
|
|
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 {
|
2019-11-27 14:33:32 +05:30
|
|
|
enter(context) {
|
|
|
|
context.navigate('/register');
|
|
|
|
}
|
2016-03-02 02:06:14 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
resolve(context, payload) {
|
|
|
|
context
|
|
|
|
.run('register', payload)
|
|
|
|
.then(() => context.setState(new CompleteState()))
|
|
|
|
.catch((err = {}) => err.errors || logger.warn('Error registering', err));
|
|
|
|
}
|
2016-03-02 02:06:14 +05:30
|
|
|
|
2019-11-27 14:33:32 +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
|
|
|
}
|
2019-11-27 14:33:32 +05:30
|
|
|
}
|
2016-03-02 02:06:14 +05:30
|
|
|
}
|