accounts-frontend/packages/app/services/authFlow/ActivationState.ts
ErickSkrauch be08857edc
Add E2E tests for device code grant flow.
Handle more errors for device code.
Dispatch a BSOD for an any unhandled exception from auth flow state
2024-12-18 01:02:02 +01:00

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());
}
}