From 6aa07d39cb1a9f9a5fa3ecee3e79b0a0cf1c77f8 Mon Sep 17 00:00:00 2001 From: sergesoroka Date: Thu, 5 Dec 2024 11:51:35 +0200 Subject: [PATCH] Changed setData logic in Survey Comp --- src/SurveyComp/SurveyComp.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/SurveyComp/SurveyComp.jsx b/src/SurveyComp/SurveyComp.jsx index 2332e8d..30475c5 100644 --- a/src/SurveyComp/SurveyComp.jsx +++ b/src/SurveyComp/SurveyComp.jsx @@ -49,6 +49,8 @@ function SurveyComponent({ setResult }) { const apiUrl = config.apiUrl; const response = await fetch(`${apiUrl}/${id}`); const data = await response.json(); + + setIntermediateData(data); // populate survye.js with data from API survey.data = data; if (data.template_status == "FINALIZED") { @@ -58,8 +60,7 @@ function SurveyComponent({ setResult }) { useEffect(() => { getTemplateInfo(); - setIntermediateData(survey.data); - }, [getTemplateInfo, id, setIntermediateData]); + }, [getTemplateInfo]); window["$"] = window["jQuery"] = $; // require("easy-autocomplete/dist/jquery.easy-autocomplete.js");