diff options
| author | Fuwn <[email protected]> | 2023-12-17 04:38:47 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-12-17 04:38:47 -0800 |
| commit | 10f98276c252eb752de261bb191ccd6d0c7f893a (patch) | |
| tree | 29e491a0b6c74b5bf9368c46494f9dc8de8a28b7 /src/lib/Media/Anime/cache.ts | |
| parent | refactor(anime): move episodes (diff) | |
| download | due.moe-10f98276c252eb752de261bb191ccd6d0c7f893a.tar.xz due.moe-10f98276c252eb752de261bb191ccd6d0c7f893a.zip | |
refactor(anime): move cache
Diffstat (limited to 'src/lib/Media/Anime/cache.ts')
| -rw-r--r-- | src/lib/Media/Anime/cache.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/Media/Anime/cache.ts b/src/lib/Media/Anime/cache.ts new file mode 100644 index 00000000..c423a419 --- /dev/null +++ b/src/lib/Media/Anime/cache.ts @@ -0,0 +1,12 @@ +import { get } from 'svelte/store'; +import anime from '../../../stores/anime'; +import { mediaListCollection, Type } from '../../AniList/media'; +import lastPruneTimes from '../../../stores/lastPruneTimes'; +import type { AniListAuthorisation, UserIdentity } from '../../AniList/identity'; + +export const cleanCache = (user: AniListAuthorisation, identity: UserIdentity) => + mediaListCollection(user, identity, Type.Anime, get(anime), get(lastPruneTimes).anime, true); + +export const updateMedia = (id: number, progress: number | undefined, callback: () => void) => { + fetch(`/api/anilist/increment?id=${id}&progress=${(progress || 0) + 1}`).then(callback); +}; |