fix: fixes personalized links when single use id is enabled (#6270)

This commit is contained in:
Anshuman Pandey
2025-07-22 17:38:45 +05:30
committed by GitHub
parent 30fdcff737
commit 3803111b19
10 changed files with 252 additions and 40 deletions

View File

@@ -92,7 +92,7 @@ export const GET = async (request: Request, props: { params: Promise<TContactLin
});
}
const surveyUrlResult = getContactSurveyLink(params.contactId, params.surveyId, 7);
const surveyUrlResult = await getContactSurveyLink(params.contactId, params.surveyId, 7);
if (!surveyUrlResult.ok) {
return handleApiError(request, surveyUrlResult.error);

View File

@@ -82,11 +82,11 @@ export const GET = async (
}
// Generate survey links for each contact
const contactLinks = contacts
.map((contact) => {
const contactLinks = await Promise.all(
contacts.map(async (contact) => {
const { contactId, attributes } = contact;
const surveyUrlResult = getContactSurveyLink(
const surveyUrlResult = await getContactSurveyLink(
contactId,
params.surveyId,
query?.expirationDays || undefined
@@ -107,10 +107,11 @@ export const GET = async (
expiresAt,
};
})
.filter(Boolean);
);
const filteredContactLinks = contactLinks.filter(Boolean);
return responses.successResponse({
data: contactLinks,
data: filteredContactLinks,
meta,
});
},