web/storage: move clearCacheStorage() logic to clear button

This commit is contained in:
jj 2025-04-30 17:17:00 +00:00
parent 54ec1645fe
commit b3f151f3cb
No known key found for this signature in database
2 changed files with 5 additions and 10 deletions

View File

@ -2,7 +2,7 @@
import { t } from "$lib/i18n/translations";
import { createDialog } from "$lib/state/dialogs";
import { clearQueue } from "$lib/state/task-manager/queue";
import { clearCacheStorage, clearFileStorage } from "$lib/storage";
import { clearFileStorage } from "$lib/storage";
import IconFileShredder from "@tabler/icons-svelte/IconFileShredder.svelte";
import DataSettingsButton from "$components/settings/DataSettingsButton.svelte";
@ -28,7 +28,10 @@
action: async () => {
clearQueue();
await clearFileStorage();
await clearCacheStorage();
if ('caches' in window) {
const keys = await caches.keys();
await Promise.all(keys.map(key => caches.delete(key)));
}
},
},
],

View File

@ -65,14 +65,6 @@ 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) {