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

@@ -23,7 +23,6 @@
<Button
href={action.href}
onclick
alignment="left"
color="tertiary"
size="lg"
@@ -229,8 +229,8 @@
$effect(() => {
groups = getGroups(
$resumables,
$profile,
$profileData.profiles,
profile.data,
profileData.profiles,
$themeData,
page.data.contextual?.actions,
)
@@ -92,7 +92,7 @@ export function getGroups(
name: t.get('nav.communities'),
icon: GlobeAlt,
},
...(amModOfAny(profile.user)
...(amModOfAny(profile.data.user)
? [
{
href: '/moderation',
@@ -101,7 +101,7 @@ export function getGroups(
},
]
: []),
...(profile.user && isAdmin(profile.user)
...(profile.data.user && isAdmin(profile.data.user)
? [
{
href: '/admin',
@@ -236,23 +236,23 @@ export function getGroups(
],
},
{
name: t.get('profile.profile'),
actions: profile.jwt
name: t.get('profile.data.profile'),
actions: profile.data.jwt
? [
{
href: '/profile/user',
name: t.get('profile.profile'),
name: t.get('profile.data.profile'),
icon: UserCircle,
},
{
href: '/inbox',
name: t.get('profile.inbox'),
name: t.get('profile.data.inbox'),
icon: Inbox,
shortcut: 'i',
},
{
href: '/saved',
name: t.get('profile.saved'),
name: t.get('profile.data.saved'),
icon: Bookmark,
},
{
@@ -311,7 +311,7 @@ export function getGroups(
icon: p.avatar ?? UserCircle,
detail: p.instance,
handle: async () => {
if (profile.id != p.id) {
if (profile.data.id != p.id) {
await setUserID(p.id)
}
@@ -407,9 +407,9 @@ export function getGroups(
],
},
{
name: t.get('profile.subscribed'),
name: t.get('profile.data.subscribed'),
actions:
profile?.user?.follows.map((f) => ({
profile.data?.user?.follows.map((f) => ({
icon: f.community.icon,
name: f.community.title,
href: `/c/${fullCommunityName(