feat: agregar dropdown de autenticación con opción de logout
All checks were successful
build-and-deploy / build (push) Successful in 23s
build-and-deploy / deploy (push) Successful in 3s

- Dropdown aparece al hacer click cuando estás conectado
- Opciones: verificar estado y cerrar sesión
- Logout usa endpoint de Authentik (/outpost.goauthentik.io/sign_out)
- Desregistra Service Worker antes de logout
- Animación smooth del dropdown
- Flecha indicadora que rota al abrir/cerrar
- Diseño glassmorphism consistente con la app
This commit is contained in:
2025-10-12 03:16:01 -06:00
parent cda4722a27
commit d31a715974
2 changed files with 222 additions and 18 deletions

View File

@@ -106,6 +106,18 @@ export const useAuth = () => {
window.location.href = window.location.origin + '/'
}
const logout = async () => {
console.log('[Auth] Logging out...')
// Marcar como no autenticado y desregistrar SW
await markUnauthenticated()
// Navegar al endpoint de logout de Authentik
// Esto cerrará la sesión y redirigirá al login
console.log('[Auth] Navigating to Authentik logout endpoint...')
window.location.href = '/outpost.goauthentik.io/sign_out'
}
const markUnauthenticated = async () => {
// Helper para marcar como no autenticado (útil cuando detectamos 401/403)
console.log('[Auth] Marking as unauthenticated')
@@ -188,6 +200,7 @@ export const useAuth = () => {
authStatus,
checkAuth,
triggerAuth,
logout,
markUnauthenticated,
setupVisibilityListener,
cleanupListeners