Change if/else on checking if end-user is subscribed

This commit is contained in:
Korbs 2024-07-17 03:57:15 -04:00
parent 75837fa2f7
commit c16c43f2d4

View file

@ -10,13 +10,19 @@ let { data: subs } = await supabase
.select("*") .select("*")
.eq('UserSubscribed', id) .eq('UserSubscribed', id)
.eq('Id', CreatorId) .eq('Id', CreatorId)
if (subs[0] === undefined) {
var Subbed = false
} else {
var Subbed = true
}
--- ---
<Base Title="Supabase Demo"> <Base Title="Supabase Demo">
<div style="display: flex; justify-content: space-between; align-items: center;"> <div style="display: flex; justify-content: space-between; align-items: center;">
<p style="font-size: 18px; font-weight: bold;">Vsause</p> <p style="font-size: 18px; font-weight: bold;">Vsause</p>
<div> <div>
{subs[0].Subscribed ? {Subbed ?
<a style="font-size: 14px;" href={"/api/account/subscription/remove?=" + 'C6nSFpj9HTCZ5t-N3Rm3-HA'}>Unsubscribe</a> <a style="font-size: 14px;" href={"/api/account/subscription/remove?=" + 'C6nSFpj9HTCZ5t-N3Rm3-HA'}>Unsubscribe</a>
: :
<a style="font-size: 14px;" href={"/api/account/subscription/add?=" + 'C6nSFpj9HTCZ5t-N3Rm3-HA'}>Subscribe</a> <a style="font-size: 14px;" href={"/api/account/subscription/add?=" + 'C6nSFpj9HTCZ5t-N3Rm3-HA'}>Subscribe</a>