diff --git a/utils/fetch-and-cache.ts b/utils/fetch-and-cache.ts index 396e226..c79c812 100644 --- a/utils/fetch-and-cache.ts +++ b/utils/fetch-and-cache.ts @@ -409,7 +409,9 @@ export async function clearCache(): Promise { redirectMap.clear(); if (SUPPORTS_CACHE_API) { - await caches.delete(CACHE_NAME); + try { + await caches.delete(CACHE_NAME); + } catch (e) { console.error(e) } openCachePromise = null; } } @@ -424,8 +426,10 @@ export async function invalidate(url: string): Promise { redirectMap.delete(url); if (SUPPORTS_CACHE_API) { - const cache = await openCache(); - await cache.delete(finalUrl); + try { + const cache = await openCache(); + await cache.delete(finalUrl); + } catch (e) { console.error(e) } } } @@ -449,6 +453,4 @@ export async function getRequest( }); return response; -} - -await clearCache() \ No newline at end of file +} \ No newline at end of file