Files
coursera-ibm-java-developer…/SmartClinicManagementSystem/app/src/main/resources/static/js/render.js

29 lines
688 B
JavaScript
Raw Normal View History

2025-11-03 18:27:23 +01:00
// render.js
function selectRole(role) {
setRole(role);
const token = localStorage.getItem('token');
if (role === "admin") {
if (token) {
window.location.href = `/adminDashboard/${token}`;
}
} 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";
}
}
}
function renderContent() {
const role = getRole();
if (!role) {
window.location.href = "/"; // if no role, send to role selection page
return;
}
}