aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Media/invalidate.ts
blob: fb9b100a17de13ea2910984b995ff0a5c1d959e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { get } from "svelte/store";
import { browser } from "$app/environment";
import { options } from "$lib/Notification/options";
import { addNotification } from "$lib/Notification/store";
import locale from "$stores/locale";
import revalidateAnime from "$stores/revalidateAnime";
import revalidateManga from "$stores/revalidateManga";

export const invalidateListCaches = () => {
	if (!browser) return;

	revalidateAnime.update((n) => n + 1);
	revalidateManga.update((n) => n + 1);

	addNotification(
		options({
			heading:
				get(locale)().notifications?.cacheInvalidated ??
				"Anime and manga list caches successfully invalidated",
		}),
	);
};