Fully working app

This commit is contained in:
2025-11-09 17:33:37 +01:00
parent f1879640c0
commit 66609ab25d
42 changed files with 710 additions and 620 deletions

View File

@@ -3,26 +3,28 @@
function selectRole(role) {
setRole(role);
const token = localStorage.getItem('token');
if (role === "admin") {
if (token) {
if (role === "admin" && token) {
window.location.href = `/adminDashboard/${token}`;
}
} if (role === "patient") {
} else if (role === "loggedPatient" && token) {
window.location.href = "/pages/loggedPatientDashboard.html";
} else if (role === "patient") {
window.location.href = "/pages/patientDashboard.html";
} else if (role === "doctor") {
if (token) {
window.location.href = `/doctorDashboard/${token}`;
} else if (role === "loggedPatient") {
window.location.href = "loggedPatientDashboard.html";
}
} else if (role === "doctor" && token) {
window.location.href = `/doctorDashboard/${token}`;
} else {
window.location.href = "/";
}
}
function renderContent() {
const role = getRole();
if (!role) {
console.error("No role set!")
window.location.href = "/"; // if no role, send to role selection page
return;
}
}
}