Merge pull request #642 from Safelite/feature/allow-blank-page-data

Add empty object for pageData by default
This commit is contained in:
katieoh-safelite 2022-08-08 10:18:46 -04:00 committed by GitHub
commit e7af5bd738
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -159,10 +159,9 @@ async function navigate(scenario, currentRoute, optionalQuery = {}, optionalPara
if (destinationFmgPageValue !== undefined) {
// We're always pushing the same path, just changing query strings. Make sure our optional query strings get combined with our fmgPage one.
// Update page data to the store for next page if provided. Otherwise, keep existing page data
if (optionalPageData !== undefined) {
baseMixin.methods.savePageDataToStore(destinationFmgPageValue, optionalPageData);
}
// Update page data to the store for next page if provided. Otherwise, keep existing page data or set to empty object
const existingPageDataForPage = store.getters.pageData(destinationFmgPageValue);
baseMixin.methods.savePageDataToStore(destinationFmgPageValue, optionalPageData ? optionalPageData : existingPageDataForPage ?? {});
// if cookie and referralNumber/Date exists OR an emailAddress has been saved
if ((getFunnelCookie()?.ReferralNumber && getFunnelCookie()?.ReferralDate) || store.getters.order.customer?.emailAddress) {