From 96f292f61ce4f874beadcc02df6c22235283a7bc Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Mon, 4 Oct 2021 07:57:14 -0700 Subject: [PATCH] JSR CHange --- client/src/utils/RenderTemplate.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/client/src/utils/RenderTemplate.js b/client/src/utils/RenderTemplate.js index d8fcc27d6..5b0122c91 100644 --- a/client/src/utils/RenderTemplate.js +++ b/client/src/utils/RenderTemplate.js @@ -209,17 +209,21 @@ const fetchContextData = async (templateObject) => { `${server}/odata/assets?$filter=name eq '${templateObject.name}.query'` ); - let templateQueryToExecute, - useShopSpecificTemplate = false; + let templateQueryToExecute; + let useShopSpecificTemplate = false; // let shopSpecificTemplate; if (shopSpecificFolder) { let shopSpecificTemplate = jsReportQueries.data.value.find( (f) => f?.folder?.shortid === shopSpecificFolder.shortid ); - useShopSpecificTemplate = true; - templateQueryToExecute = atob(shopSpecificTemplate.content); - } else { + if (shopSpecificTemplate) { + useShopSpecificTemplate = true; + templateQueryToExecute = atob(shopSpecificTemplate.content); + } + } + + if (!templateQueryToExecute) { const generalTemplate = jsReportQueries.data.value.find((f) => !f.folder); useShopSpecificTemplate = false; templateQueryToExecute = atob(generalTemplate.content);