From c343586fbef32cbadbc20cfdedbee0cc6df3b545 Mon Sep 17 00:00:00 2001 From: MHerholdt94 Date: Mon, 8 Jan 2024 15:04:54 +0100 Subject: [PATCH 1/4] Modifies if statements to properly display nav links depending on log-in state --- src/js/ui/header/index.js | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/js/ui/header/index.js b/src/js/ui/header/index.js index 1b6c4461..e3e4c2dd 100644 --- a/src/js/ui/header/index.js +++ b/src/js/ui/header/index.js @@ -33,12 +33,6 @@ export const header = () => { `); }; -// For testing states -const stateValue = 'null'; -localStorage.setItem('Role', stateValue); -let pageTitle = document.querySelector('title'); -pageTitle.innerText = 'Standard'; - /** * * This function is adding the navigation to the header element based on the state of thus user. @@ -50,7 +44,7 @@ pageTitle.innerText = 'Standard'; * */ export const checkState = () => { - const role = localStorage.getItem('Role'); + const role = localStorage.getItem('role'); const navBarNav = document.getElementById('navbarNav'); if (role == 'user') { return (navBarNav.innerHTML = ``); } - // The profile button on here is for development reasons - if (role == 'null') { - return (navBarNav.innerHTML = `