From 641927f864c05aaa83d596c813dc23644cb598e8 Mon Sep 17 00:00:00 2001 From: Korbs Date: Sun, 8 Sep 2024 22:37:18 -0400 Subject: [PATCH] Check if the creator is live or not --- source/src/pages/live.astro | 48 +++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/source/src/pages/live.astro b/source/src/pages/live.astro index 0af3632..984df18 100755 --- a/source/src/pages/live.astro +++ b/source/src/pages/live.astro @@ -14,9 +14,14 @@ import { ArrowDown } from "@iconoir/vue"; // Fetch const CreatorName = Astro.url.href.split("live?=").pop(); -const Creator = await fetch( - "https://twitch-backend.sudovanilla.org" + "/api/users/" + CreatorName, -).then((response) => response.json()); +const Creator = await fetch("https://twitch-backend.sudovanilla.org" + "/api/users/" + CreatorName,).then((response) => response.json()); + +// Check if the Creator is live +if(Creator.isLive === true) { + var IsLive = true +} else if(Creator.isLive === false) { + var IsLive = false +} --- @@ -36,21 +41,31 @@ const Creator = await fetch(

{Creator.data.username}

- | -

{Creator.data.stream.title}

+ {IsLive ? + | +

{Creator.data.stream.title}

+ : + null + }

{Creator.data.followers} Followers

- + {IsLive ? + + : +
+

They're currently offline.

+
+ }