diff options
| -rw-r--r-- | src/lib/CommandPalette/actions.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/CommandPalette/actions.ts b/src/lib/CommandPalette/actions.ts index 01259130..48603504 100644 --- a/src/lib/CommandPalette/actions.ts +++ b/src/lib/CommandPalette/actions.ts @@ -1,3 +1,8 @@ +import { browser } from "$app/environment"; +import localforage from "localforage"; +import { addNotification } from "$lib/Notification/store"; +import { options } from "$lib/Notification/options"; + export interface CommandPaletteAction { name: string; url: string; @@ -165,4 +170,22 @@ export const defaultActions: CommandPaletteAction[] = [ url: "/user?badges=1", tags: ["user", "me", "settings"], }, + { + name: "Clear Anime & Manga List Caches", + url: "", + preventDefault: true, + tags: ["cache", "clear", "refresh", "debug", "anime", "manga", "list"], + onClick: async () => { + if (!browser) return; + + await localforage.removeItem("anime"); + await localforage.removeItem("manga"); + + addNotification( + options({ + heading: "Anime and manga list caches successfully cleared", + }), + ); + }, + }, ]; |