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, { forcePrune: true }); export const updateMedia = (id: number, progress: number | undefined, callback: () => void) => { fetch(`/api/anilist/increment?id=${id}&progress=${(progress || 0) + 1}`).then(callback); };