auth: update profile class to contain profileData as well
This commit is contained in:
13 files changed
+238
-265
No files matched your search
@@ -3,7 +3,6 @@
|
||||
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import { profileData } from '$lib/auth.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
|
||||
@@ -12,6 +11,7 @@
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util.svelte'
|
||||
import { MINIMUM_VERSION } from '$lib/version'
|
||||
import { Button, Note, TextInput, toast } from 'mono-svelte'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
|
||||
interface Props {
|
||||
ref?: string
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
let form = $state({
|
||||
instance: '',
|
||||
username: `${$t('account.guest')} ${profileData.profiles.filter(p => p.jwt == undefined).length + 1}`,
|
||||
username: `${$t('account.guest')} ${profile.meta.profiles.filter(p => p.jwt == undefined).length + 1}`,
|
||||
loading: false,
|
||||
})
|
||||
|
||||
@@ -35,13 +35,13 @@
|
||||
return
|
||||
}
|
||||
|
||||
const id = Math.max(...profileData.profiles.map(i => i.id)) + 1
|
||||
profileData.profiles.push({
|
||||
const id = Math.max(...profile.meta.profiles.map(i => i.id)) + 1
|
||||
profile.meta.profiles.push({
|
||||
id: id,
|
||||
instance: form.instance,
|
||||
username: form.username,
|
||||
})
|
||||
profileData.profile = id
|
||||
profile.meta.profile = id
|
||||
|
||||
toast({ content: $t('toast.addAccount'), type: 'success' })
|
||||
|
||||
|
||||
Reference in new issue
Block a user