Fix caching API routes in PWA service worker

environments/review-front-deve-otr6gc/deployments/13419
Kasper Seweryn 2022-05-03 02:55:56 +02:00 zatwierdzone przez Georg Krause
rodzic 461aa51e03
commit a872f752c5
2 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -13,7 +13,6 @@ export const install: InitModule = ({ store }) => {
})
watch(() => store.state.auth.authenticated, (authenticated) => {
console.log(Math.random())
if (authenticated) return open()
close()
}, { immediate: true })

Wyświetl plik

@ -30,6 +30,7 @@ registerRoute(({ url }) => {
if (url.pathname.startsWith('/api/v1/listen')) return false
return url.pathname.startsWith('/api/v1')
}, new NetworkFirst({
cacheName: 'API Routes',
plugins: [
// Expire after a week
new ExpirationPlugin({ maxAgeSeconds: 7 * 24 * 3600 })