2016-11-13 20:17:56 +05:30
|
|
|
import AbstractState from './AbstractState';
|
|
|
|
import LoginState from './LoginState';
|
|
|
|
import CompleteState from './CompleteState';
|
|
|
|
|
|
|
|
export default class ChooseAccountState extends AbstractState {
|
|
|
|
enter(context) {
|
2018-02-18 01:29:35 +05:30
|
|
|
const { auth } = context.getState();
|
|
|
|
|
|
|
|
if (auth.oauth) {
|
|
|
|
context.navigate('/oauth/choose-account');
|
|
|
|
} else {
|
|
|
|
context.navigate('/choose-account');
|
|
|
|
}
|
2016-11-13 20:17:56 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
resolve(context, payload) {
|
|
|
|
if (payload.id) {
|
|
|
|
context.setState(new CompleteState());
|
|
|
|
} else {
|
|
|
|
context.navigate('/login');
|
2018-02-18 01:29:35 +05:30
|
|
|
context.run('setLogin', null);
|
2016-11-13 20:17:56 +05:30
|
|
|
context.setState(new LoginState());
|
|
|
|
}
|
|
|
|
}
|
2016-11-19 17:49:23 +05:30
|
|
|
|
2017-03-07 04:13:33 +05:30
|
|
|
reject(context) {
|
|
|
|
context.run('logout');
|
2016-11-19 17:49:23 +05:30
|
|
|
}
|
2016-11-13 20:17:56 +05:30
|
|
|
}
|