Skip to content

Commit a022edd

Browse files
committed
add created case to session
1 parent aec43b3 commit a022edd

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

frontend/app/@types/express-session.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'express-session';
22

33
import type { IDTokenClaims } from '~/.server/auth/auth-strategies';
4+
import type { PersonSinCase } from '~/.server/domain/multi-channel/case-api-service-models';
45

56
declare module 'express-session' {
67
interface SessionData {
@@ -15,6 +16,7 @@ declare module 'express-session' {
1516
returnUrl?: URL;
1617
state: string;
1718
};
19+
createdCases: Record<string, PersonSinCase>;
1820
}
1921
}
2022

frontend/app/routes/protected/person-case/review.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,15 @@ export async function action({ context, params, request }: Route.ActionArgs) {
6969
const sinApplicationService = getSinApplicationService();
7070
const response = await sinApplicationService.submitSinApplication(inPersonSinApplication);
7171

72-
//TODO: store the response in session
73-
console.log('SIN Application submitted successfully:', response);
72+
if (response.identificationId === undefined) {
73+
throw new AppError(`Failed to submit SIN application: ${action}`, ErrorCodes.SUBMIT_SIN_APPLICATION_FAILED);
74+
}
75+
76+
const createdCase = { caseId: response.identificationId, ...inPersonSinApplication };
77+
context.session.createdCases = {
78+
...(context.session.createdCases ?? {}),
79+
[createdCase.caseId]: createdCase,
80+
};
7481

7582
machineActor.send({ type: 'submitReview' });
7683
break;

0 commit comments

Comments
 (0)