mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-10 10:02:02 +05:30
20 lines
522 B
JavaScript
20 lines
522 B
JavaScript
|
import AbstractState from './AbstractState';
|
||
|
import PasswordState from './PasswordState';
|
||
|
|
||
|
export default class LoginState extends AbstractState {
|
||
|
enter(context) {
|
||
|
const {user} = context.getState();
|
||
|
|
||
|
if (user.email || user.username) {
|
||
|
context.setState(new PasswordState());
|
||
|
} else {
|
||
|
context.navigate('/login');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
resolve(context, payload) {
|
||
|
context.run('login', payload)
|
||
|
.then(() => context.setState(new PasswordState()));
|
||
|
}
|
||
|
}
|