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 -15
View File
@@ -21,7 +21,7 @@
let form = $state({
instance: '',
username: `${$t('account.guest')} ${$profileData.profiles.filter((p) => p.jwt == undefined).length + 1}`,
username: `${$t('account.guest')} ${profileData.profiles.filter((p) => p.jwt == undefined).length + 1}`,
loading: false,
})
@@ -33,21 +33,13 @@
return
}
profileData.update((pd) => {
// too lazy to make a decent system
const id = Math.floor(Math.random() * 100000)
const newProfile: Profile = {
id: id,
instance: form.instance,
username: form.username,
}
return {
profile: id,
profiles: [...pd.profiles, newProfile],
}
const id = Math.max(...profileData.profiles.map((i) => i.id)) + 1
profileData.profiles.push({
id: id,
instance: form.instance,
username: form.username,
})
profileData.profile = id
toast({ content: $t('toast.addAccount'), type: 'success' })