feat: set response limit to 50 if the created survey is in-app

This commit is contained in:
ShubhamPalriwala
2023-08-09 18:43:50 +05:30
parent b072d3b549
commit 5520edb2c5
2 changed files with 8 additions and 2 deletions

View File

@@ -22,9 +22,12 @@ export default function SurveyStarter({
const router = useRouter();
const newSurveyFromTemplate = async (template: Template) => {
setIsCreateSurveyLoading(true);
const surveyType = environment?.widgetSetupCompleted ? "web" : "link";
const autoComplete = surveyType === "web" ? 50 : null;
const augmentedTemplate = {
...template.preset,
type: environment?.widgetSetupCompleted ? "web" : "link",
type: surveyType,
autoComplete,
};
try {
const survey = await createSurveyAction(environmentId, augmentedTemplate);

View File

@@ -71,9 +71,12 @@ export default function TemplateList({
const addSurvey = async (activeTemplate) => {
setLoading(true);
const surveyType = environment?.widgetSetupCompleted ? "web" : "link";
const autoComplete = surveyType === "web" ? 50 : null;
const augmentedTemplate = {
...activeTemplate.preset,
type: environment?.widgetSetupCompleted ? "web" : "link",
type: surveyType,
autoComplete,
};
const survey = await createSurveyAction(environmentId, augmentedTemplate);
router.push(`/environments/${environmentId}/surveys/${survey.id}/edit`);