mirror of
https://github.com/navidrome/navidrome.git
synced 2025-05-15 09:36:38 +03:00
21 lines
533 B
JavaScript
21 lines
533 B
JavaScript
export const removeHomeCache = async () => {
|
|
try {
|
|
const workboxKey = (await caches.keys()).find((key) =>
|
|
key.startsWith('workbox-precache'),
|
|
)
|
|
if (!workboxKey) return
|
|
|
|
const workboxCache = await caches.open(workboxKey)
|
|
const indexKey = (await workboxCache.keys()).find((key) =>
|
|
key.url.includes('app/index.html'),
|
|
)
|
|
|
|
if (indexKey) {
|
|
await workboxCache.delete(indexKey)
|
|
}
|
|
} catch (e) {
|
|
// eslint-disable-next-line no-console
|
|
console.error('error reading cache', e)
|
|
}
|
|
}
|