mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-27 23:40:28 +05:30
be08857edc
Handle more errors for device code. Dispatch a BSOD for an any unhandled exception from auth flow state
30 lines
908 B
TypeScript
30 lines
908 B
TypeScript
import AbstractState from './AbstractState';
|
|
import { AuthContext } from './AuthFlow';
|
|
import CompleteState from './CompleteState';
|
|
|
|
export default class PermissionsState extends AbstractState {
|
|
enter(context: AuthContext): Promise<void> | void {
|
|
context.navigate('/oauth/permissions', {
|
|
// replacing oauth entry point if currently on it
|
|
// to allow user easy go-back action to client's site
|
|
replace: context.getRequest().path.includes('oauth2'),
|
|
});
|
|
}
|
|
|
|
resolve(context: AuthContext): Promise<void> | void {
|
|
return this.process(context, true);
|
|
}
|
|
|
|
reject(context: AuthContext): void {
|
|
this.process(context, false);
|
|
}
|
|
|
|
process(context: AuthContext, accept: boolean): Promise<void> | void {
|
|
return context.setState(
|
|
new CompleteState({
|
|
accept,
|
|
}),
|
|
);
|
|
}
|
|
}
|