fix: update return types for redirectGrouped and groupFailure functions
Modified the return types of the redirectGrouped and groupFailure functions in signup-http.tsx to support Promise<Response> in addition to Response. This change enhances the handling of asynchronous operations within the signup process, ensuring better integration with modern JavaScript practices.
This commit is contained in:
1 parent
38c08cf872
commit
16ef47d8bf
1 file changed
+2
-2
+2
-2
@@ -291,7 +291,7 @@ function redirectGrouped(
|
|||||||
services: SignupServices,
|
services: SignupServices,
|
||||||
pageShiftId: number,
|
pageShiftId: number,
|
||||||
signups: Array<{ signupId: number; shiftId: number; manageToken: string | null }>,
|
signups: Array<{ signupId: number; shiftId: number; manageToken: string | null }>,
|
||||||
): Response {
|
): Promise<Response> | Response {
|
||||||
const primary = signups.find((row) => row.shiftId === pageShiftId) ?? signups[0];
|
const primary = signups.find((row) => row.shiftId === pageShiftId) ?? signups[0];
|
||||||
if (!primary) return html(c, services, 'That page is not available · Hope Volunteer', <NotFoundPage />, 404);
|
if (!primary) return html(c, services, 'That page is not available · Hope Volunteer', <NotFoundPage />, 404);
|
||||||
const issued = signups.every((row) => row.manageToken)
|
const issued = signups.every((row) => row.manageToken)
|
||||||
@@ -315,7 +315,7 @@ function groupFailure(
|
|||||||
selectedDateIds: number[],
|
selectedDateIds: number[],
|
||||||
reason: 'not_found' | 'closed' | 'early' | 'full' | 'duplicate' | 'conflict',
|
reason: 'not_found' | 'closed' | 'early' | 'full' | 'duplicate' | 'conflict',
|
||||||
shiftId: number,
|
shiftId: number,
|
||||||
): Response {
|
): Promise<Response> | Response {
|
||||||
const failed = getPublicShift(services.db, shiftId, services.now());
|
const failed = getPublicShift(services.db, shiftId, services.now());
|
||||||
const label = failed ? shiftChoiceLabel(failed, shift) : undefined;
|
const label = failed ? shiftChoiceLabel(failed, shift) : undefined;
|
||||||
const errors: SignupErrors = {};
|
const errors: SignupErrors = {};
|
||||||
|
|||||||
Reference in new issue
Block a user