diff options
| author | Fuwn <[email protected]> | 2023-09-10 02:09:38 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-09-10 02:11:59 -0700 |
| commit | 3f0754c899f84648f05b3a8fbf0a6e66d9ec3bdf (patch) | |
| tree | a1f3bee47db0c7097703e0247c120e66d1d9e6b1 /src/lib/anime.ts | |
| parent | refactor(anime): generalise episodes (diff) | |
| download | due.moe-3f0754c899f84648f05b3a8fbf0a6e66d9ec3bdf.tar.xz due.moe-3f0754c899f84648f05b3a8fbf0a6e66d9ec3bdf.zip | |
refactor(anime): generalise clean cache
Diffstat (limited to 'src/lib/anime.ts')
| -rw-r--r-- | src/lib/anime.ts | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/lib/anime.ts b/src/lib/anime.ts index 8547882f..2ebdf25e 100644 --- a/src/lib/anime.ts +++ b/src/lib/anime.ts @@ -1,4 +1,19 @@ -import type { Media } from './AniList/media'; +import { get } from 'svelte/store'; +import anime from '../stores/anime'; +import { mediaListCollection, type Media, Type } from './AniList/media'; +import lastPruneTimes from '../stores/lastPruneTimes'; +import type { AniListAuthorisation, UserIdentity } from './AniList/identity'; + +export const cleanCache = (user: AniListAuthorisation, identity: UserIdentity) => { + return mediaListCollection( + user, + identity, + Type.Anime, + get(anime), + get(lastPruneTimes).anime, + true + ); +}; export const totalEpisodes = (anime: Media) => { return anime.episodes === null ? '' : `<span style="opacity: 50%">/${anime.episodes}</span>`; |