2016-11-13 20:17:56 +05:30
|
|
|
import AbstractState from './AbstractState';
|
|
|
|
import LoginState from './LoginState';
|
|
|
|
import CompleteState from './CompleteState';
|
2017-01-31 11:35:36 +05:30
|
|
|
import RegisterState from './RegisterState';
|
2016-11-13 20:17:56 +05:30
|
|
|
|
|
|
|
export default class ChooseAccountState extends AbstractState {
|
|
|
|
enter(context) {
|
|
|
|
context.navigate('/oauth/choose-account');
|
|
|
|
}
|
|
|
|
|
|
|
|
resolve(context, payload) {
|
|
|
|
if (payload.id) {
|
|
|
|
context.setState(new CompleteState());
|
|
|
|
} else {
|
|
|
|
context.navigate('/login');
|
|
|
|
context.setState(new LoginState());
|
|
|
|
}
|
|
|
|
}
|
2016-11-19 17:49:23 +05:30
|
|
|
|
2017-01-31 11:35:36 +05:30
|
|
|
/**
|
|
|
|
* @param {object} context
|
|
|
|
* @param {object} payload
|
|
|
|
* @param {bool} [payload.logout=false]
|
|
|
|
*/
|
|
|
|
reject(context, payload = {}) {
|
|
|
|
if (payload.logout) {
|
|
|
|
context.run('logout');
|
|
|
|
} else {
|
|
|
|
context.setState(new RegisterState());
|
|
|
|
}
|
2016-11-19 17:49:23 +05:30
|
|
|
}
|
2016-11-13 20:17:56 +05:30
|
|
|
}
|