This commit is contained in:
2025-09-12 12:35:33 -06:00
parent ae4029ac4e
commit ff33729aba
+9
View File
@@ -36,6 +36,7 @@ const Home = () => {
useEffect(() => {
const params = new URLSearchParams(window.location.search);
const token = params.get("token");
const error = params.get("error");
if (token) {
localStorage.setItem("token", token);
@@ -45,6 +46,14 @@ const Home = () => {
const cleanUrl = window.location.origin + window.location.pathname;
window.history.replaceState({}, document.title, cleanUrl);
}
if (error) {
// Aquí decides cómo manejarlo
alert("Error de inicio de sesión: NO AUTORIZADO");
// Si quieres limpiar la URL después
const cleanUrl = window.location.origin + window.location.pathname;
window.history.replaceState({}, document.title, cleanUrl);
}
setTokenProcessed(true); // ✅ Ya procesamos token
}, []);