From 92293c66156e49f801fed6e8cc0996fd88f5f33b Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Sun, 3 Sep 2023 18:36:53 -0700
Subject: feat(settings): move last prune times to store

---
 src/lib/List/Due/AnimeList.svelte | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

(limited to 'src/lib/List/Due/AnimeList.svelte')

diff --git a/src/lib/List/Due/AnimeList.svelte b/src/lib/List/Due/AnimeList.svelte
index 1409730f..f70363f3 100644
--- a/src/lib/List/Due/AnimeList.svelte
+++ b/src/lib/List/Due/AnimeList.svelte
@@ -5,8 +5,8 @@
 	import type { UserIdentity, AniListAuthorisation } from '$lib/AniList/identity';
 	import { onDestroy, onMount } from 'svelte';
 	import anime from '../../../stores/anime';
-	import animeLastPrune from '../../../stores/mangaLastPrune';
 	import settings from '../../../stores/settings';
+	import lastPruneTimes from '../../../stores/lastPruneTimes';
 
 	export let user: AniListAuthorisation;
 	export let identity: UserIdentity;
@@ -19,12 +19,19 @@
 	const keyCacher = setInterval(() => {
 		startTime = performance.now();
 		endTime = -1;
-		animeLists = mediaListCollection(user, identity, Type.Anime, $anime, $animeLastPrune, true);
+		animeLists = mediaListCollection(
+			user,
+			identity,
+			Type.Anime,
+			$anime,
+			$lastPruneTimes.anime,
+			true
+		);
 	}, Number($settings.cacheMinutes || 10) * 1000 * 60);
 
 	onMount(async () => {
 		startTime = performance.now();
-		animeLists = mediaListCollection(user, identity, Type.Anime, $anime, $animeLastPrune);
+		animeLists = mediaListCollection(user, identity, Type.Anime, $anime, $lastPruneTimes.anime);
 	});
 
 	onDestroy(() => {
@@ -133,7 +140,14 @@
 
 	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, $animeLastPrune, true);
+			animeLists = mediaListCollection(
+				user,
+				identity,
+				Type.Anime,
+				$anime,
+				$lastPruneTimes.anime,
+				true
+			);
 		});
 	};
 </script>
-- 
cgit v1.2.3

