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
21 lines
774 B
TypeScript
21 lines
774 B
TypeScript
import { AuthContext } from 'app/services/authFlow';
|
|
|
|
import AbstractState from './AbstractState';
|
|
import CompleteState from './CompleteState';
|
|
import ResendActivationState from './ResendActivationState';
|
|
|
|
export default class ActivationState extends AbstractState {
|
|
enter(context: AuthContext): Promise<void> | void {
|
|
const url = context.getRequest().path.includes('/activation') ? context.getRequest().path : '/activation';
|
|
context.navigate(url);
|
|
}
|
|
|
|
resolve(context: AuthContext, payload: { key: string }): Promise<void> | void {
|
|
return context.run('activate', payload.key).then(() => context.setState(new CompleteState()));
|
|
}
|
|
|
|
reject(context: AuthContext): void {
|
|
context.setState(new ResendActivationState());
|
|
}
|
|
}
|