Fix channel
This commit is contained in:
parent
cd314d0780
commit
a52bb64780
1 changed files with 29 additions and 5 deletions
|
@ -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", " <br/> ");
|
||||
|
||||
// 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) {
|
||||
|
||||
if (Guest === false) {
|
||||
if (subs[0] === undefined) {
|
||||
var Subbed = false
|
||||
} else {
|
||||
} else {
|
||||
var Subbed = true
|
||||
}
|
||||
}
|
||||
else {
|
||||
var Subbed = "NotLoggedIn"
|
||||
}
|
||||
---
|
||||
|
||||
|
@ -43,6 +56,17 @@ if (subs[0] === undefined) {
|
|||
:
|
||||
<a href={'/api/subscription/add?=' + CreatorId}>Follow</a>
|
||||
}
|
||||
{
|
||||
()=> {
|
||||
if (Subbed === true) {
|
||||
return <a href={'/api/subscription/remove?=' + CreatorId}>Unfollow</a>
|
||||
} else if (Subbed === false) {
|
||||
return <a href={'/api/subscription/add?=' + CreatorId}>Follow</a>
|
||||
} else if(Subbed === "NotLoggedIn") {
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
<div class="channel">
|
||||
<div class="channel-header">
|
||||
<div class="channel-banner">
|
||||
|
@ -68,7 +92,7 @@ if (subs[0] === undefined) {
|
|||
<div class="channel-tab-content">
|
||||
<p><Fragment set:html={DescriptionFormat}/></p>
|
||||
<hr/>
|
||||
<h2>{t("CHANNEL.LATEST")}</h2>
|
||||
<h2>Latest Videos</h2>
|
||||
<div class="video-grid">
|
||||
{channel.latestVideos.map((data) =>
|
||||
<Video
|
||||
|
|
Reference in a new issue