You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2023/01/25 04:29:25 UTC

[sling-org-apache-sling-app-cms] 02/02: SLING-11762 - Fixing reload behavior

This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit a4f8844501bca956dcf54330e82932e3d773ad1c
Author: Dan Klco <kl...@adobe.com>
AuthorDate: Tue Jan 24 23:29:16 2023 -0500

    SLING-11762 - Fixing reload behavior
---
 ui/src/main/frontend/js/cms.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ui/src/main/frontend/js/cms.js b/ui/src/main/frontend/js/cms.js
index 28ce9cd2..5531d442 100644
--- a/ui/src/main/frontend/js/cms.js
+++ b/ui/src/main/frontend/js/cms.js
@@ -147,15 +147,20 @@ window.Sling.CMS = {
       if (window.self !== window.top) {
         CMS = window.top.Sling.CMS;
       }
+      let loc = window.location;
+      if (window.self !== window.top) {
+        loc = window.top.location;
+      }
       if (response.redirected && response.url.indexOf('/system/sling/form/login?resource=') !== -1) {
         CMS.ui.confirmMessage('301', 'Not logged in, please login again', () => {
-          window.location = `/system/sling/form/login?resource=${encodeURIComponent(window.location)}`;
+          const resource = encodeURIComponent(`${loc.pathname}${loc.search}`);
+          window.location = `/system/sling/form/login?resource=${resource}`;
         });
         return false;
       }
       if (!response.ok) {
         CMS.ui.confirmMessage(response.status, response.statusText, () => {
-          window.location = response.url;
+          window.location.reload();
         });
         return false;
       }