Skip to content

Commit

Permalink
ch[#162034509] Hide dashboard icon for respective roles
Browse files Browse the repository at this point in the history
  • Loading branch information
ebenezerdon committed Nov 19, 2018
1 parent 537474b commit 46751a1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions UI/assets/js/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ const nav = `
<a href="../index.html"><img src="../assets/images/logo.png" alt=""></a>
</div>
<p id="logout-button">Logout</p>
<a href="attendantdashboard.html"><i class="far fa-user-circle"></i></a>
<a href="admindashboard.html"><i class="far fa-user-circle"></i></a>
<a href="#"><i class="far fa-bell"></i></a>
<a href="attendantdashboard.html" id="attendant-logo"><i class="far fa-user-circle"></i></a>
<a href="admindashboard.html" id="admin-logo"><i class="far fa-user-circle"></i></a>
</div>
<div class="nav-2">
<div class="wrap">
Expand All @@ -21,6 +20,12 @@ const nav = `
`;
document.getElementById('navbar').innerHTML = nav;

if (localStorage.role === 'admin') {
document.getElementById('attendant-logo').style.display = 'none';
} else {
document.getElementById('admin-logo').style.display = 'none';
}

const logoutButton = document.getElementById('logout-button');
const logout = () => {
localStorage.removeItem('accesstoken');
Expand All @@ -29,4 +34,4 @@ const logout = () => {
window.location.replace('../index.html');
};

logoutButton.addEventListener('click', logout);
logoutButton.addEventListener('click', logout);

0 comments on commit 46751a1

Please sign in to comment.