From 0191de155936da3d7c0fa503ab93ab542571f585 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Tue, 30 Jan 2024 21:50:44 -0800
Subject: refactor(anime): global subsPlease cache

---
 src/routes/+layout.svelte | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'src/routes/+layout.svelte')

diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index dc7cbd15..ab9bd40a 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -19,6 +19,7 @@
 	import type { LocaleDictionary } from '$lib/Locale/layout';
 	import locale from '$stores/locale';
 	import Skeleton from '$lib/Skeleton.svelte';
+	import subsPlease from '$stores/subsPlease';
 
 	export let data;
 
@@ -68,6 +69,15 @@
 			getUserIdentity(data.user).then((h) => {
 				if ($userIdentity.id === -2) userIdentity.set(h);
 			});
+
+		if (!$subsPlease)
+			subsPlease.set(
+				await (
+					await fetch(
+						root(`/api/subsplease?tz=${Intl.DateTimeFormat().resolvedOptions().timeZone}`)
+					)
+				).json()
+			);
 	});
 </script>
 
-- 
cgit v1.2.3

