added admin login redirect to admin dashboard
This commit is contained in:
@@ -112,9 +112,14 @@
|
||||
// Store token in localStorage
|
||||
localStorage.setItem("access_token", data.access_token);
|
||||
localStorage.setItem("username", data.username);
|
||||
// Redirect to home page
|
||||
|
||||
// Redirect based on is_admin from login response
|
||||
setTimeout(() => {
|
||||
window.location.href = "/";
|
||||
if (data.is_admin === true) {
|
||||
window.location.href = "/admin.html";
|
||||
} else {
|
||||
window.location.href = "/";
|
||||
}
|
||||
}, 1000);
|
||||
} else {
|
||||
showMessage(data.detail || "Login failed", "error");
|
||||
|
||||
Reference in New Issue
Block a user