Files
accounts-frontend/packages/app/services/authFlow/RegisterState.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

34 lines
1.0 KiB
TypeScript

import AbstractState from './AbstractState';
import { AuthContext } from './AuthFlow';
import CompleteState from './CompleteState';
import ActivationState from './ActivationState';
import ResendActivationState from './ResendActivationState';
export default class RegisterState extends AbstractState {
enter(context: AuthContext): Promise<void> | void {
context.navigate('/register');
}
resolve(
context: AuthContext,
payload: {
email: string;
username: string;
password: string;
rePassword: string;
captcha: string;
rulesAgreement: boolean;
},
): Promise<void> | void {
return context.run('register', payload).then(() => context.setState(new CompleteState()));
}
reject(context: AuthContext, payload: Record<string, any>): void {
if (payload.requestEmail) {
context.setState(new ResendActivationState());
} else {
context.setState(new ActivationState());
}
}
}