29 lines
688 B
JavaScript
29 lines
688 B
JavaScript
|
|
// 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;
|
||
|
|
}
|
||
|
|
}
|