From 9f0bbee596b22e5dc12359164b8fd556e957ff09 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Mon, 22 Feb 2021 20:41:32 +0200 Subject: Change Redux store items from map to object --- src/pages/FormPage.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/pages') diff --git a/src/pages/FormPage.tsx b/src/pages/FormPage.tsx index 865497c..e7d40cf 100644 --- a/src/pages/FormPage.tsx +++ b/src/pages/FormPage.tsx @@ -249,7 +249,7 @@ function FormPage(): JSX.Element { questionRef.current.validateField(); } // In case when field is invalid, add this to invalid fields list - if (valid.get(question.id) === false) { + if (!valid[question.id]) { invalidFieldIDs.push(i); } }); @@ -293,15 +293,15 @@ function FormPage(): JSX.Element { case QuestionType.Checkbox: { if (typeof options !== "string") { - const checkbox_values = values.get(question.id); + const checkbox_values = values[question.id]; const keys: Map = new Map(); options.forEach((val: string, index) => { keys.set(val, `${("000" + index).slice(-4)}. ${val}`); }); - if (checkbox_values instanceof Map) { + if (typeof checkbox_values === "object" && checkbox_values) { const pairs: { [key: string]: boolean } = { }; keys.forEach((val, key) => { - pairs[key] = !!checkbox_values.get(val); + pairs[key] = checkbox_values[val]; }); answers[question.id] = pairs; } @@ -311,7 +311,7 @@ function FormPage(): JSX.Element { case QuestionType.Code: default: - answers[question.id] = values.get(question.id); + answers[question.id] = values[question.id]; } }); -- cgit v1.2.3