Files
coursera-ibm-java-developer…/SmartClinicManagementSystem/app/src/main/resources/static/js/render.js
John Ahlroos 95b26b2e6e
Some checks failed
Compile Java Backend / Compile Backend Code (push) Successful in 1m23s
Lint Java Backend / Checkstyle Java Linting (push) Successful in 46s
Lint Dockerfiles / Lint Dockerfiles (push) Failing after 30s
Lint Frontend / Lint HTML, CSS, and JS (push) Successful in 31s
Fix linting issues
2025-11-10 18:10:46 +01:00

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;
}
}