From c81e430c62459255fe02a75d3794860acd02c3b8 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 10 Sep 2023 02:15:56 -0700 Subject: refactor(anime): generalise update media --- src/lib/anime.ts | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/lib/anime.ts') diff --git a/src/lib/anime.ts b/src/lib/anime.ts index 2ebdf25e..c9bba378 100644 --- a/src/lib/anime.ts +++ b/src/lib/anime.ts @@ -15,6 +15,10 @@ export const cleanCache = (user: AniListAuthorisation, identity: UserIdentity) = ); }; +export const updateMedia = (id: number, progress: number | undefined, callback: () => void) => { + fetch(`/anilist/increment?id=${id}&progress=${(progress || 0) + 1}`).then(callback); +}; + export const totalEpisodes = (anime: Media) => { return anime.episodes === null ? '' : `/${anime.episodes}`; }; -- cgit v1.2.3