diff --git a/src/lib/auth.ts b/src/lib/auth.ts index 020e2e31..a9f9652b 100644 --- a/src/lib/auth.ts +++ b/src/lib/auth.ts @@ -123,8 +123,9 @@ export let profile: Readable = derived( .then((res) => { if (!res?.user) toast({ - content: 'Your login has expired. Re-login to fix this issue.', - type: 'warning', + content: + "Your account's instance did not return your user data. Your login may have expired.", + type: 'error', }) site.set(res?.site) @@ -324,16 +325,6 @@ function serializeUser(user: Profile): Profile { } } -instance.subscribe(async (i) => { - try { - // fetching site is handled by auth.ts if logged in - if (get(profile)?.jwt) return - const s = await new LemmyHttp(`https://${i}`).getSite() - - site.set(s) - } catch (e) {} -}) - export async function setUserID(id: number) { profileData.update((p) => ({ ...p, profile: id })) return get(profile) diff --git a/src/lib/lemmy.ts b/src/lib/lemmy.ts index e41f30e6..e45defe5 100644 --- a/src/lib/lemmy.ts +++ b/src/lib/lemmy.ts @@ -65,10 +65,11 @@ export function client({ let jwt = auth ? auth : get(profile)?.jwt - let headers = jwt ? { Authorization: `Bearer ${jwt}` } : { Authorization: '' } + let headers = jwt ? { Authorization: `Bearer ${jwt}` } : {} return new LemmyHttp(instanceToURL(instanceURL), { fetchFunction: (input, init) => customFetch(func, input, init, jwt), + //@ts-ignore headers: headers, }) }