2025-11-03 18:27:23 +01:00
|
|
|
// render.js
|
|
|
|
|
|
|
|
|
|
function selectRole(role) {
|
|
|
|
|
setRole(role);
|
|
|
|
|
const token = localStorage.getItem('token');
|
2025-11-09 17:33:37 +01:00
|
|
|
if (role === "admin" && token) {
|
2025-11-03 18:27:23 +01:00
|
|
|
window.location.href = `/adminDashboard/${token}`;
|
2025-11-09 17:33:37 +01:00
|
|
|
|
|
|
|
|
} else if (role === "loggedPatient" && token) {
|
|
|
|
|
window.location.href = "/pages/loggedPatientDashboard.html";
|
|
|
|
|
|
|
|
|
|
} else if (role === "patient") {
|
2025-11-03 18:27:23 +01:00
|
|
|
window.location.href = "/pages/patientDashboard.html";
|
2025-11-09 17:33:37 +01:00
|
|
|
|
|
|
|
|
} else if (role === "doctor" && token) {
|
|
|
|
|
window.location.href = `/doctorDashboard/${token}`;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
window.location.href = "/";
|
2025-11-03 18:27:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function renderContent() {
|
|
|
|
|
const role = getRole();
|
|
|
|
|
if (!role) {
|
2025-11-09 17:33:37 +01:00
|
|
|
console.error("No role set!")
|
2025-11-03 18:27:23 +01:00
|
|
|
window.location.href = "/"; // if no role, send to role selection page
|
|
|
|
|
return;
|
|
|
|
|
}
|
2025-11-09 17:33:37 +01:00
|
|
|
}
|