diff --git a/source/src/pages/channel/[...slug].astro b/source/src/pages/channel/[...slug].astro
index dde71c4..cb9d54c 100755
--- a/source/src/pages/channel/[...slug].astro
+++ b/source/src/pages/channel/[...slug].astro
@@ -17,6 +17,13 @@ const CreatorId = Astro.url.href.split("channel/").pop();
const channel = await fetch(DEFAULT_MEDIA_DATA_PROXY + "/api/v1/channels/" + CreatorId).then((response) => response.json());
const DescriptionFormat = channel.descriptionHtml.replaceAll("\n", "
");
+// Is the user logged in?
+if (Astro.cookies.get('sb-access-token') === undefined) {
+ var Guest = true
+} else {
+ var Guest = false
+}
+
// User Subscription
import { supabase } from "@library/supabase"
const { data: { user } } = await supabase.auth.getUser()
@@ -27,10 +34,16 @@ let { data: subs } = await supabase
.eq('UserSubscribed', id)
.eq('Id', CreatorId)
-if (subs[0] === undefined) {
- var Subbed = false
-} else {
- var Subbed = true
+
+if (Guest === false) {
+ if (subs[0] === undefined) {
+ var Subbed = false
+ } else {
+ var Subbed = true
+ }
+}
+else {
+ var Subbed = "NotLoggedIn"
}
---
@@ -43,6 +56,17 @@ if (subs[0] === undefined) {
:
Follow
}
+ {
+ ()=> {
+ if (Subbed === true) {
+ return Unfollow
+ } else if (Subbed === false) {
+ return Follow
+ } else if(Subbed === "NotLoggedIn") {
+ return null
+ }
+ }
+ }