mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-13 00:39:02 +05:30
24 lines
578 B
JavaScript
24 lines
578 B
JavaScript
|
import AbstractState from './AbstractState';
|
||
|
import CompleteState from './CompleteState';
|
||
|
|
||
|
export default class AcceptRulesState extends AbstractState {
|
||
|
enter(context) {
|
||
|
const {user} = context.getState();
|
||
|
|
||
|
if (user.shouldAcceptRules) {
|
||
|
context.navigate('/accept-rules');
|
||
|
} else {
|
||
|
context.setState(new CompleteState());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
resolve(context) {
|
||
|
context.run('acceptRules')
|
||
|
.then(() => context.setState(new CompleteState()));
|
||
|
}
|
||
|
|
||
|
reject(context) {
|
||
|
context.run('logout');
|
||
|
}
|
||
|
}
|