fix: desregistrar Service Worker al perder autenticación
- Desregistrar SW automáticamente cuando se detecta pérdida de auth - Desregistrar SW antes de triggerAuth para evitar conflictos con Authentik - Deshabilitar polling y listeners de visibility (causan errores de CORS) - Confiar en detección reactiva de errores del musicStore - Usar window.location.href en lugar de reload() para forzar navegación
This commit is contained in:
@@ -37,22 +37,25 @@ const musicStore = useMusicStore()
|
||||
// Check auth on mount and setup listeners
|
||||
onMounted(async () => {
|
||||
// Asumimos autenticado inicialmente (si la página cargó, pasamos Authentik)
|
||||
// Solo verificamos para confirmar
|
||||
await checkAuth(false)
|
||||
// NO hacemos checkAuth inicial para evitar conflictos con Service Worker y Authentik
|
||||
console.log('[AuthIndicator] Mounted - assuming authenticated (page loaded successfully)')
|
||||
setupVisibilityListener()
|
||||
|
||||
// Polling más inteligente: solo si estamos autenticados
|
||||
// POLLING DESHABILITADO: Causa conflictos con Authentik cuando no estamos autenticados
|
||||
// En su lugar, confiamos en la detección reactiva de errores del musicStore
|
||||
console.log('[AuthIndicator] Polling disabled - relying on reactive error detection')
|
||||
|
||||
/* CÓDIGO DESHABILITADO
|
||||
const interval = setInterval(() => {
|
||||
if (!document.hidden && isAuthenticated.value) {
|
||||
// Solo hace polling si creemos estar autenticados
|
||||
// Evita spam de requests cuando ya sabemos que no estamos autenticados
|
||||
checkAuth(false)
|
||||
}
|
||||
}, 60000) // 60 segundos (menos agresivo)
|
||||
}, 60000)
|
||||
|
||||
onUnmounted(() => {
|
||||
clearInterval(interval)
|
||||
})
|
||||
*/
|
||||
})
|
||||
|
||||
// Cleanup listeners on unmount
|
||||
|
||||
Reference in New Issue
Block a user