Skip to content

Commit 8ffd486

Browse files
committed
fix(api): correctly resolve multiple redirect prompt settings
1 parent ec20f40 commit 8ffd486

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

apps/api/src/services/survey/survey.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,17 +431,17 @@ function surveyService({
431431

432432
const urls = redirectPrompts.reduce<string | null | Record<string, string>>(
433433
(acc, { id, identifier, url }) => {
434-
let identifierValue: string | null;
434+
let identifierValue: string | undefined;
435435
switch (identifier) {
436436
case 'userId':
437437
identifierValue = user.id;
438438
break;
439439
case 'username':
440440
case 'urlAuthToken':
441-
identifierValue = aliases.length ? aliases[0][identifier] : null;
441+
identifierValue = aliases.at(0)?.[identifier];
442442
break;
443443
default:
444-
identifierValue = customFields.length ? customFields[0].value : null;
444+
identifierValue = customFields.find(field => field.name === identifier)?.value;
445445
break;
446446
}
447447

0 commit comments

Comments
 (0)