Skip to content

Commit

Permalink
fix: reading undefined additional metadata (#958)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali-D-Akbar authored Apr 17, 2024
1 parent ad9b6a3 commit 2c7ccd1
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/data/actions/courseInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,18 @@ function updateFormValuesAfterSave(change, currentFormValues, initialValues) {
per_lead_usa: perLeadUSA,
per_lead_international: perLeadInternational,
per_click_usa: perClickUSA,
per_click_international: perClicknternational,
},
additional_metadata: {
certificate_info: {
heading,
blurb,
},
per_click_international: perClickInternational,
},
additional_metadata: additionalMetadata,
} = initialValues;

const {
certificate_info: {
heading,
blurb,
} = {},
} = additionalMetadata || {};

// This emits a redux action called CHANGE that will update:
change('imageSrc', initialImageSrc);
change('geoLocationLat', geoLocationLat);
Expand All @@ -137,7 +139,7 @@ function updateFormValuesAfterSave(change, currentFormValues, initialValues) {
change('in_year_value.per_lead_usa', perLeadUSA);
change('in_year_value.per_lead_international', perLeadInternational);
change('in_year_value.per_click_usa', perClickUSA);
change('in_year_value.per_click_international', perClicknternational);
change('in_year_value.per_click_international', perClickInternational);
change('additional_metadata.certificate_info.heading', heading);
change('additional_metadata.certificate_info.blurb', blurb);
for (let i = 0; i < initialCourseRuns.length; i += 1) {
Expand Down

0 comments on commit 2c7ccd1

Please sign in to comment.