Fix caching API routes in PWA service worker

This commit is contained in:
Kasper Seweryn 2022-05-03 02:55:56 +02:00 committed by Georg Krause
parent 461aa51e03
commit a872f752c5
2 changed files with 1 additions and 1 deletions

View File

@ -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 })

View File

@ -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 })