Skip to content
Snippets Groups Projects
Commit e94b2143 authored by Jiří Helebrant's avatar Jiří Helebrant
Browse files

Check for auth when adding submenu links

parent 8831dd0a
No related merge requests found
......@@ -225,7 +225,7 @@
});
links_nav.forEach((o) => {
console.log(o);
const addedItems = [];
const toggleInput = document.createElement("input");
const className = o.submenu["en"].replace(/[ \.]/, "").toLowerCase();
toggleInput.type = "checkbox";
......@@ -249,14 +249,23 @@
});
o.items.forEach((item) => {
addMenuLink(item.url, item.title, oNav);
fetch(item.url, {
method: "HEAD",
credentials: "same-origin",
redirect: "follow",
}).then((r) => {
if (r.ok) {
addMenuLink(item.url, item.title, oNav);
addedItems.push(item);
}
});
});
console.log(oNav);
nav.appendChild(toggleLabel);
nav.appendChild(toggleInput);
nav.appendChild(oNav);
if (addedItems.length > 0) {
nav.appendChild(toggleLabel);
nav.appendChild(toggleInput);
nav.appendChild(oNav);
}
});
if (accountNav.children.length > 0) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment