2016-03-02 02:06:14 +05:30
|
|
|
import AbstractState from './AbstractState';
|
|
|
|
import CompleteState from './CompleteState';
|
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) {
|
|
|
|
const {user} = context.getState();
|
|
|
|
|
|
|
|
if (!user.isGuest) {
|
|
|
|
context.setState(new CompleteState());
|
|
|
|
} else {
|
|
|
|
context.navigate('/register');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resolve(context, payload) {
|
|
|
|
context.run('register', payload)
|
|
|
|
.then(() => context.setState(new CompleteState()));
|
|
|
|
}
|
|
|
|
|
|
|
|
reject(context) {
|
2016-05-23 09:20:10 +05:30
|
|
|
context.setState(new ResendActivationState());
|
2016-03-02 02:06:14 +05:30
|
|
|
}
|
|
|
|
}
|