aboutsummaryrefslogtreecommitdiff
path: root/public/js/menu.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js/menu.js')
-rw-r--r--public/js/menu.js27
1 files changed, 9 insertions, 18 deletions
diff --git a/public/js/menu.js b/public/js/menu.js
index 5e02387..c0ec623 100644
--- a/public/js/menu.js
+++ b/public/js/menu.js
@@ -122,29 +122,20 @@ function checkMenuEntry(page_id){
122 const checkbox = clicked_menu_entry.querySelector("input"); 122 const checkbox = clicked_menu_entry.querySelector("input");
123 let color; 123 let color;
124 124
125 fetch('index.php?menu_edit=display_in_menu', { 125 new Fetcher({
126 endpoint: 'index.php?menu_edit=display_in_menu',
126 method: 'POST', 127 method: 'POST',
127 headers: { 128 onSuccess: (data) => {
128 'Content-Type': 'application/json' 129 color = checkbox.checked ? "#ff1d04" : "grey";
130 clicked_menu_entry.querySelector("button").style.color = color;
131 nav_zone.innerHTML = '';
132 nav_zone.insertAdjacentHTML('afterbegin', data.nav);
129 }, 133 },
130 body: JSON.stringify({ id: clicked_menu_entry.id, checked: checkbox.checked }) 134 onFailure: (data) => {
131 })
132 .then(response => response.json())
133 .then(data => {
134 if(data.success){
135 color = checkbox.checked ? "#ff1d04" : "grey";
136 clicked_menu_entry.querySelector("button").style.color = color;
137
138 nav_zone.innerHTML = '';
139 nav_zone.insertAdjacentHTML('afterbegin', data.nav);
140 }
141 else{
142 console.error('Échec de l\'inversion'); 135 console.error('Échec de l\'inversion');
143 } 136 }
144 }) 137 })
145 .catch(error => { 138 .send({id: clicked_menu_entry.id, checked: checkbox.checked});
146 console.error('Erreur:', error);
147 });
148} 139}
149 140
150function editUrl(page_id, selector){ 141function editUrl(page_id, selector){