auth: rename profile.data -> profile.current

This commit is contained in:
James Xylight committed 2025-07-12 10:26:45 -07:00
1 parent 1edad4ac60
commit 36a9631707
76 files changed
+233 -224

No files matched your search

@@ -30,7 +30,7 @@
let data = $state(pageData)
async function unblockUser(item: PersonBlockView) {
if (!profile.data?.jwt) return
if (!profile.current?.jwt) return
data.person_blocks.splice(
data.person_blocks.findIndex(i => i.target.id == item.target.id),
@@ -46,7 +46,7 @@
}
async function unblockCommunity(item: CommunityBlockView) {
if (!profile.data?.jwt) return
if (!profile.current?.jwt) return
data.community_blocks.splice(
data.community_blocks.findIndex(i => i.community.id == item.community.id),
@@ -63,7 +63,7 @@
}
async function unblockInstances(item: InstanceBlockView) {
if (!profile.data?.jwt) return
if (!profile.current?.jwt) return
if (!data.my_user?.instance_blocks) return
data.my_user.instance_blocks.splice(
@@ -21,8 +21,8 @@
old_password: oldPassword,
})
if (res?.jwt) {
const { instance, username } = profile.data
deleteProfile(profile.data.id)
const { instance, username } = profile.current
deleteProfile(profile.current.id)
await setUser(res.jwt, instance, username!)
toast({ content: $t('toast.loginRefresh'), type: 'success' })
@@ -41,7 +41,7 @@
let bannerImage: FileList | undefined = $state()
async function save() {
if (!formData || !profile.data?.jwt) return
if (!formData || !profile.current?.jwt) return
loading = true
@@ -49,16 +49,16 @@
let pfp = profileImage
? await uploadImage(
profileImage[0],
profile.data.instance,
profile.data.jwt,
profile.current.instance,
profile.current.jwt,
)
: undefined
let banner = bannerImage
? await uploadImage(
bannerImage[0],
profile.data.instance,
profile.data.jwt,
profile.current.instance,
profile.current.jwt,
)
: undefined
+4 -3
View File
@@ -6,11 +6,12 @@ import { error } from '@sveltejs/kit'
export const ssr = false
export async function load({ fetch }) {
if (!profile.data.jwt) error(401)
if (!profile.current.jwt) error(401)
const my_user =
// profile.data?.user ??
(await client({ auth: profile.data?.jwt, func: fetch }).getSite()).my_user
// profile.current?.user ??
(await client({ auth: profile.current?.jwt, func: fetch }).getSite())
.my_user
return {
my_user: my_user,
+1 -1
View File
@@ -3,7 +3,7 @@ import { client } from '$lib/lemmy.svelte.js'
import { ReactiveState } from '$lib/promise.svelte.js'
export async function load({ fetch, url }) {
const { jwt } = profile.data
const { jwt } = profile.current
const page = Number(url.searchParams.get('page')) || 1