Fix caching API routes in PWA service worker
This commit is contained in:
parent
461aa51e03
commit
a872f752c5
|
@ -13,7 +13,6 @@ export const install: InitModule = ({ store }) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(() => store.state.auth.authenticated, (authenticated) => {
|
watch(() => store.state.auth.authenticated, (authenticated) => {
|
||||||
console.log(Math.random())
|
|
||||||
if (authenticated) return open()
|
if (authenticated) return open()
|
||||||
close()
|
close()
|
||||||
}, { immediate: true })
|
}, { immediate: true })
|
||||||
|
|
|
@ -30,6 +30,7 @@ registerRoute(({ url }) => {
|
||||||
if (url.pathname.startsWith('/api/v1/listen')) return false
|
if (url.pathname.startsWith('/api/v1/listen')) return false
|
||||||
return url.pathname.startsWith('/api/v1')
|
return url.pathname.startsWith('/api/v1')
|
||||||
}, new NetworkFirst({
|
}, new NetworkFirst({
|
||||||
|
cacheName: 'API Routes',
|
||||||
plugins: [
|
plugins: [
|
||||||
// Expire after a week
|
// Expire after a week
|
||||||
new ExpirationPlugin({ maxAgeSeconds: 7 * 24 * 3600 })
|
new ExpirationPlugin({ maxAgeSeconds: 7 * 24 * 3600 })
|
||||||
|
|
Loading…
Reference in New Issue