Skip to content

Commit

Permalink
Added saveOnValueChanged function
Browse files Browse the repository at this point in the history
  • Loading branch information
sergesoroka committed Mar 28, 2024
1 parent b5b7de8 commit 1dcd20f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/SurveyComp/SurveyComp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ function SurveyComponent({ setResult }) {
setIntermediateData(survey.data);
}

function saveinLocalSurveyData(survey) {
setIntermediateData(survey.data);
const data = survey.data;
data.pageNo = survey.currentPageNo;
window.localStorage.setItem(storageItemKey, JSON.stringify(data));
}
// function saveinLocalSurveyData(survey) {
// setIntermediateData(survey.data);
// const data = survey.data;
// data.pageNo = survey.currentPageNo;
// window.localStorage.setItem(storageItemKey, JSON.stringify(data));
// }

// Save survey results to the local storage
survey.onValueChanged.add(saveinLocalSurveyData);
survey.onValueChanged.add(saveSurveyData);
survey.onCurrentPageChanged.add(saveSurveyData);

// Empty the local storage after the survey is completed
Expand Down

0 comments on commit 1dcd20f

Please sign in to comment.