mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-06 09:00:18 -06:00
fix: fixes personalized links when single use id is enabled (#6270)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user