Преглед изворни кода

trying to fix redirect to home bug : replaced cookie by localStorage, seems to work

Bachir Soussi Chiadmi пре 6 година
родитељ
комит
52f5a24742

+ 4 - 3
sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js

@@ -129,7 +129,7 @@
       _$body.removeClass('ajax-loading');
     };
     function onAjaxLoaded(data, url, ajax_path, sys_path, selector){
-      console.log('ajax loaded url:'+url+' ajax_path:'+ajax_path+' sys_path:'+sys_path+'  data', data);
+      console.log('ajax loaded url:'+url+' ajax_path:'+ajax_path+' sys_path:'+sys_path);
 
       // reset all style may been added by other pages (like masonry for productions)
       // and replace all content with newly loaded
@@ -272,8 +272,9 @@
         history.replaceState(state, null, origin_url);
         // load content through ajax
         ajaxLoadContent(null, state.sys_path, state.ajax_path);
-        // reset the cookie
-        deleteCookie('edlp_origin_path');
+        // reset the storage
+        window.localStorage.removeItem("edlp_origin_path");
+        window.localStorage.removeItem("edlp_origin_url");
 
       }else{
         history.replaceState({home:true}, null, url);

+ 4 - 3
sites/all/themes/custom/edlptheme/assets/scripts/main.js

@@ -129,7 +129,7 @@
       _$body.removeClass('ajax-loading');
     };
     function onAjaxLoaded(data, url, ajax_path, sys_path, selector){
-      console.log('ajax loaded url:'+url+' ajax_path:'+ajax_path+' sys_path:'+sys_path+'  data', data);
+      console.log('ajax loaded url:'+url+' ajax_path:'+ajax_path+' sys_path:'+sys_path);
 
       // reset all style may been added by other pages (like masonry for productions)
       // and replace all content with newly loaded
@@ -272,8 +272,9 @@
         history.replaceState(state, null, origin_url);
         // load content through ajax
         ajaxLoadContent(null, state.sys_path, state.ajax_path);
-        // reset the cookie
-        deleteCookie('edlp_origin_path');
+        // reset the storage
+        window.localStorage.removeItem("edlp_origin_path");
+        window.localStorage.removeItem("edlp_origin_url");
 
       }else{
         history.replaceState({home:true}, null, url);