Fully working app
This commit is contained in:
@@ -14,7 +14,7 @@ function renderHeader() {
|
||||
}
|
||||
|
||||
const role = localStorage.getItem("userRole");
|
||||
const token = localStorage.getItem("TOKEN");
|
||||
const token = localStorage.getItem("token");
|
||||
|
||||
let headerContent = `<header class="header">
|
||||
<div class="logo-section">
|
||||
@@ -30,7 +30,7 @@ function renderHeader() {
|
||||
return;
|
||||
} else if (role === "admin") {
|
||||
headerContent += `
|
||||
<button id="addDocBtn" class="adminBtn" onclick="openModal('addDoctor')">Add Doctor</button>
|
||||
<button id="addDocBtn" class="adminBtn">Add Doctor</button>
|
||||
<a href="#" onclick="logout()">Logout</a>`;
|
||||
} else if (role === "doctor") {
|
||||
headerContent += `
|
||||
@@ -67,12 +67,15 @@ function attachHeaderButtonListeners() {
|
||||
|
||||
function logout() {
|
||||
localStorage.removeItem("userRole");
|
||||
localStorage.removeItem("TOKEN");
|
||||
localStorage.removeItem("token");
|
||||
window.location.href = "/";
|
||||
}
|
||||
|
||||
function logoutPatient() {
|
||||
localStorage.removeItem("userRole");
|
||||
selectRole('patient');
|
||||
window.location.href='/pages/loggedPatientDashboard.html';
|
||||
}
|
||||
localStorage.removeItem("token");
|
||||
setRole('patient')
|
||||
window.location.href='/pages/patientDashboard.html';
|
||||
}
|
||||
|
||||
renderHeader();
|
||||
Reference in New Issue
Block a user