All checks were successful
CI / build (pull_request) Successful in 54s
CI / lint (pull_request) Successful in 1m11s
CI / unit (pull_request) Successful in 1m0s
CI / frontend (pull_request) Successful in 1m49s
CI / mutation (pull_request) Successful in 4m3s
CI / verify-stack (pull_request) Successful in 7m42s
Add an error branch to submit(): on a failed BFF call, set a `failed` signal, re-enable the button, and render a role="alert" message so the user knows the submit did not go through and can retry — instead of the click silently doing nothing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
import { Component, inject, signal } from '@angular/core';
|
|
import { BffApiV1Service, type SubmitAccepted } from 'api-client';
|
|
import { AuthService } from 'auth';
|
|
import { UtrechtComponentsModule } from 'ui';
|
|
|
|
/**
|
|
* The self-service submit page: a signed-in zorgprofessional confirms and submits their BIG
|
|
* registration. The bsn comes from the DigiD token (not a form field), so this is a confirm-and-
|
|
* submit flow that posts to the BFF and shows the returned reference (ADR-0010; S-08c).
|
|
*/
|
|
@Component({
|
|
selector: 'app-registration-page',
|
|
imports: [UtrechtComponentsModule],
|
|
templateUrl: './registration-page.html',
|
|
})
|
|
export class RegistrationPage {
|
|
private readonly auth = inject(AuthService);
|
|
private readonly bff = inject(BffApiV1Service);
|
|
|
|
protected readonly bsn = this.auth.bsn;
|
|
protected readonly submitting = signal(false);
|
|
protected readonly reference = signal<string | undefined>(undefined);
|
|
protected readonly submitted = signal(false);
|
|
protected readonly failed = signal(false);
|
|
|
|
submit(): void {
|
|
this.submitting.set(true);
|
|
this.failed.set(false);
|
|
this.bff.postSelfServiceRegistrations().subscribe({
|
|
next: (accepted: SubmitAccepted) => {
|
|
this.reference.set(accepted.registrationId);
|
|
this.submitted.set(true);
|
|
this.submitting.set(false);
|
|
},
|
|
// Surface the failure instead of swallowing it: re-enable the button so the user can retry.
|
|
error: () => {
|
|
this.failed.set(true);
|
|
this.submitting.set(false);
|
|
},
|
|
});
|
|
}
|
|
}
|