feat: use state based auth instead of store based (#488)

* misc: switch to state for auth

* fix: class based auth not working
This commit is contained in:
Xylight authored and GitHub committed 2025-02-08 13:49:09 -08:00
1 parent 8c6ff77fac
commit 5651ad475d
83 files changed
+395 -469

No files matched your search

+7 -7
View File
@@ -77,7 +77,7 @@
style="border-radius: inherit;"
>
<div class="ml-auto"></div>
{#if $profile?.user && isAdmin($profile.user)}
{#if profile.data?.user && isAdmin(profile.data.user)}
<NavButton
href="/admin"
label={$t('nav.admin')}
@@ -92,7 +92,7 @@
{/if}
</NavButton>
{/if}
{#if amModOfAny($profile?.user)}
{#if amModOfAny(profile.data?.user)}
<NavButton
href="/moderation"
label={$t('nav.moderation')}
@@ -124,7 +124,7 @@
/>
{/snippet}
<MenuDivider>{$t('nav.create.label')}</MenuDivider>
<MenuButton link href="/create/post" disabled={!$profile?.jwt}>
<MenuButton link href="/create/post" disabled={!profile.data?.jwt}>
{#snippet prefix()}
<Icon src={PencilSquare} size="16" micro />
{/snippet}
@@ -133,17 +133,17 @@
<MenuButton
link
href="/create/community"
disabled={!$profile?.jwt ||
!$profile?.user ||
disabled={!profile.data?.jwt ||
!profile.data?.user ||
($site?.site_view.local_site.community_creation_admin_only &&
!isAdmin($profile.user))}
!isAdmin(profile.data.user))}
>
{#snippet prefix()}
<Icon src={Newspaper} size="16" micro />
{/snippet}
{$t('nav.create.community')}
</MenuButton>
{#if !$profile?.jwt}
{#if !profile.data?.jwt}
<span class="text-sm mx-4 my-1 py-1">
{$t('nav.create.logingate')}
</span>