Skip to content

Commit

Permalink
♻️ Update function to use map over for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
shea-maykinmedia committed Jun 4, 2021
1 parent 52782d1 commit fca3f09
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/Summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,15 @@ Templates.addTemplate('overview', {


const loadStepsData = async (submission) => {
const stepsInfo = [];
for (let submissionStep of submission.steps) {
return await Promise.all(submission.steps.map(async (submissionStep) => {
const stepDetail = await get(submissionStep.url);
const formStepDetail = await get(submissionStep.formStep);
const formDefinitionDetail = await get(formStepDetail.formDefinition);
stepsInfo.push({submissionStep,
return {submissionStep,
title: formDefinitionDetail.name,
data: {data: stepDetail.data},
configuration: stepDetail.formStep.configuration});
}
return stepsInfo;
configuration: stepDetail.formStep.configuration};
}));
};


Expand Down Expand Up @@ -84,8 +82,7 @@ const Summary = ({ submission, onConfirm, onShowStep }) => {
key={index}
form={step.configuration}
submission={step.data}
// Pass template in here. Still pass renderMode and flatten
options={{noAlerts: true, readOnly: true, renderMode: 'html', template: 'overview', flatten: true}}
options={{noAlerts: true, readOnly: true, renderMode: 'html', template: 'overview'}}
/>
</Fragment>
))}
Expand Down

0 comments on commit fca3f09

Please sign in to comment.