Update detection of guest and logged in usesr, add tooltip

This commit is contained in:
Korbs 2024-08-10 20:10:17 -04:00
parent 709592a9d7
commit 5b3b85ae8a

View file

@ -26,12 +26,12 @@ import {
PlanetAlt,
InputSearch,
Settings,
LogIn
LogIn,
LogOut
} from '@iconoir/vue'
// i18n
import i18next, { t } from "i18next"
import SettingsLayout from '@layouts/Settings.astro'
// Supabase Data
import { supabase } from "@library/supabase"
@ -39,7 +39,7 @@ const { data: { user } } = await supabase.auth.getUser()
const id = user?.id
// Is the user logged in?
if (user?.id === "undefined") {
if (Astro.cookies.get('sb-access-token') === undefined) {
var Guest = true
} else {
var Guest = false
@ -61,8 +61,12 @@ let { data: subs } = await supabase
<div class="sidebar-top-start">
<a href='/'><img src="/images/logo/MinPluto - Logo.png"/></a>
<div>
<a href="/login"><LogIn/></a>
<a href="#"><Settings/></a>
{Guest ?
<a title="Login" href="/login"><LogIn/></a>
:
<a title="Log Out" href="/api/auth/logout"><LogOut/></a>
}
<a title="Settings" href="#"><Settings/></a>
</div>
</div>
<div class="sidebar-top-end">