From b9c147f9f3c61936e83c8dbcb53bb3e8a7ce6653 Mon Sep 17 00:00:00 2001 From: Konrad Ryczko Date: Sat, 27 Jan 2024 13:50:34 +0100 Subject: [PATCH] Fix/Answers mapping --- src/pages/survey/[surveyId]/index.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pages/survey/[surveyId]/index.tsx b/src/pages/survey/[surveyId]/index.tsx index 41c61842..022b5715 100644 --- a/src/pages/survey/[surveyId]/index.tsx +++ b/src/pages/survey/[surveyId]/index.tsx @@ -9,6 +9,15 @@ import ExternalPageWrapper from 'layout/ExternalRouteWrapper'; export async function getServerSideProps(context: NextPageContext) { const surveyData = await getSurveyData(context.query.surveyId as string); + if (surveyData) { + surveyData.questions = surveyData?.questions.map((question) => { + return { + ...question, + answer: '', + }; + }); + } + return { props: { initialData: JSON.parse(JSON.stringify(surveyData)),