mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-30 10:42:34 +05:30
30 lines
680 B
TypeScript
30 lines
680 B
TypeScript
import AbstractState from './AbstractState';
|
|
import LoginState from './LoginState';
|
|
import CompleteState from './CompleteState';
|
|
|
|
export default class ChooseAccountState extends AbstractState {
|
|
enter(context) {
|
|
const { auth } = context.getState();
|
|
|
|
if (auth.oauth) {
|
|
context.navigate('/oauth/choose-account');
|
|
} else {
|
|
context.navigate('/choose-account');
|
|
}
|
|
}
|
|
|
|
resolve(context, payload) {
|
|
if (payload.id) {
|
|
context.setState(new CompleteState());
|
|
} else {
|
|
context.navigate('/login');
|
|
context.run('setLogin', null);
|
|
context.setState(new LoginState());
|
|
}
|
|
}
|
|
|
|
reject(context) {
|
|
context.run('logout');
|
|
}
|
|
}
|