Merge pull request #630 from Safelite/feature/CSR-702
CSR-702 Don't default page data to empty object
This commit is contained in:
commit
bce215c5d0
1 changed files with 4 additions and 5 deletions
|
|
@ -151,7 +151,7 @@ router.afterEach((to, from) => {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
router.navigate = (scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData = {}) => {
|
router.navigate = (scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData) => {
|
||||||
navigate(scenario, currentRoute, optionalQuery, optionalParams, optionalPageData);
|
navigate(scenario, currentRoute, optionalQuery, optionalParams, optionalPageData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -163,7 +163,7 @@ router.navigateToExternalUrl = (url, optionalQuery = {}) => {
|
||||||
// PRIVATE FUNCTIONS
|
// PRIVATE FUNCTIONS
|
||||||
|
|
||||||
// Navigate to the next route, depending on the scenario.
|
// Navigate to the next route, depending on the scenario.
|
||||||
async function navigate(scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData = {}) {
|
async function navigate(scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData) {
|
||||||
if (!scenario) {
|
if (!scenario) {
|
||||||
console.error("No scenario provided. Please review the routing table.");
|
console.error("No scenario provided. Please review the routing table.");
|
||||||
return;
|
return;
|
||||||
|
|
@ -176,9 +176,8 @@ async function navigate(scenario, currentRoute, optionalQuery = {}, optionalPara
|
||||||
if (destinationFmgPageValue !== undefined) {
|
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.
|
// 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, use existing page data or override with empty object
|
// Update page data to the store for next page if provided. Otherwise, keep existing page data
|
||||||
const existingPageData = store.getters.pageData(destinationFmgPageValue) ?? {};
|
if (optionalPageData !== undefined) {
|
||||||
if (Object.keys(optionalPageData).length > 0 && Object.keys(existingPageData).length === 0) {
|
|
||||||
baseMixin.methods.savePageDataToStore(destinationFmgPageValue, optionalPageData);
|
baseMixin.methods.savePageDataToStore(destinationFmgPageValue, optionalPageData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue