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) => {
|
||||
console.log(Math.random())
|
||||
if (authenticated) return open()
|
||||
close()
|
||||
}, { immediate: true })
|
||||
|
|
|
@ -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 })
|
||||
|
|
Loading…
Reference in New Issue