Skip to content

best way to save what you love

web/storage: add clearCacheStorage function

wukkodc33c07b398c
diff --git a/web/src/lib/storage.ts b/web/src/lib/storage.ts
index 3d9a04a3..30a6ffea 100644
--- a/web/src/lib/storage.ts
+++ b/web/src/lib/storage.ts
@@ -64,6 +64,14 @@ export const clearFileStorage = async () => {
}
}
+export const clearCacheStorage = async () => {
+ const keys = await caches.keys();
+
+ for (const key of keys) {
+ caches.delete(key);
+ }
+}
+
export const getStorageQuota = async () => {
let estimate;
if (navigator.storage.estimate) {