Improve PWA offline functionality and fix session caching

- Enable navigateFallback for offline navigation support
- Add JSON files to glob patterns for heroicons support
- Change Authentik API caching from NetworkFirst to NetworkOnly to prevent stale session data
- Add offline detection in checkSessionStatus with proper user feedback
- Add no-cache headers to /api/auth/status endpoint to prevent browser caching
- Show "Modo Offline" toast when user tries to check session while offline
This commit is contained in:
2025-10-13 02:21:50 -06:00
parent 226fcc7c64
commit 87ae5b95e6
3 changed files with 35 additions and 11 deletions

View File

@@ -72,22 +72,15 @@ export default defineNuxtConfig({
]
},
workbox: {
navigateFallback: undefined,
globPatterns: ['**/*.{js,css,html,png,svg,ico}'],
navigateFallback: '/',
globPatterns: ['**/*.{js,css,html,png,svg,ico,json}'],
cleanupOutdatedCaches: true,
runtimeCaching: [
{
urlPattern: /^https:\/\/authentik\.nucleoriofrio\.com\/.*/i,
handler: 'NetworkFirst',
handler: 'NetworkOnly',
options: {
cacheName: 'authentik-api-cache',
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 // 24 hours
},
cacheableResponse: {
statuses: [0, 200]
}
networkTimeoutSeconds: 10
}
}
]