Fully working app
This commit is contained in:
@@ -3,26 +3,28 @@
|
||||
function selectRole(role) {
|
||||
setRole(role);
|
||||
const token = localStorage.getItem('token');
|
||||
if (role === "admin") {
|
||||
if (token) {
|
||||
if (role === "admin" && token) {
|
||||
window.location.href = `/adminDashboard/${token}`;
|
||||
}
|
||||
} if (role === "patient") {
|
||||
|
||||
} 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") {
|
||||
if (token) {
|
||||
window.location.href = `/doctorDashboard/${token}`;
|
||||
} else if (role === "loggedPatient") {
|
||||
window.location.href = "loggedPatientDashboard.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user