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/List/Due | |
| 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/List/Due')
| -rw-r--r-- | src/lib/List/Due/AnimeList.svelte | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/src/lib/List/Due/AnimeList.svelte b/src/lib/List/Due/AnimeList.svelte index 0be1ba1e..66a26712 100644 --- a/src/lib/List/Due/AnimeList.svelte +++ b/src/lib/List/Due/AnimeList.svelte @@ -7,7 +7,7 @@ import anime from '../../../stores/anime'; import settings from '../../../stores/settings'; import lastPruneTimes from '../../../stores/lastPruneTimes'; - import { airingTime, totalEpisodes } from '$lib/anime'; + import { airingTime, cleanCache, totalEpisodes } from '$lib/anime'; export let user: AniListAuthorisation; export let identity: UserIdentity; @@ -107,27 +107,9 @@ const updateMedia = async (id: number, progress: number | undefined) => { fetch(`/anilist/increment?id=${id}&progress=${(progress || 0) + 1}`).then(() => { - animeLists = mediaListCollection( - user, - identity, - Type.Anime, - $anime, - $lastPruneTimes.anime, - true - ); + animeLists = cleanCache(user, identity); }); }; - - const cleanCache = () => { - animeLists = mediaListCollection( - user, - identity, - Type.Anime, - $anime, - $lastPruneTimes.anime, - true - ); - }; </script> {#await animeLists} @@ -144,7 +126,12 @@ {#if cleanedMedia.length === 0} <ul> - <li>No anime to display. <a href={'#'} on:click={cleanCache}>Force refresh</a></li> + <li> + No anime to display. <a + href={'#'} + on:click={() => (animeLists = cleanCache(user, identity))}>Force refresh</a + > + </li> </ul> {/if} |