30 lines
754 B
JavaScript
30 lines
754 B
JavaScript
// render.js
|
|
|
|
function selectRole(role) {
|
|
setRole(role);
|
|
const token = localStorage.getItem('token');
|
|
if (role === "admin" && token) {
|
|
window.location.href = `/adminDashboard/${token}`;
|
|
|
|
} 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" && 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;
|
|
}
|
|
} |