From e01fcee89e826bd6277df27961909122acf45503 Mon Sep 17 00:00:00 2001 From: Xyphyn Date: Tue, 1 Aug 2023 13:59:33 -0700 Subject: [PATCH] feat: add instance to sidebar --- src/lib/auth.ts | 7 +++++-- src/lib/components/ui/Sidebar.svelte | 7 ++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/lib/auth.ts b/src/lib/auth.ts index 0ec0fc67..f63b5270 100644 --- a/src/lib/auth.ts +++ b/src/lib/auth.ts @@ -42,10 +42,13 @@ export const profileData = writable( getFromStorage('profileData') ?? { profiles: [], profile: -1 } ) -profileData.subscribe((pd) => { +let initialInstance = get(profileData).defaultInstance + +profileData.subscribe(async (pd) => { setFromStorage('profileData', pd) - if (pd.profile == -1) { + if (pd.profile == -1 && pd.defaultInstance != initialInstance) { + initialInstance = get(profileData).defaultInstance ?? DEFAULT_INSTANCE_URL instance.set(get(profileData).defaultInstance ?? DEFAULT_INSTANCE_URL) } }) diff --git a/src/lib/components/ui/Sidebar.svelte b/src/lib/components/ui/Sidebar.svelte index 82f76b0c..ecd28a52 100644 --- a/src/lib/components/ui/Sidebar.svelte +++ b/src/lib/components/ui/Sidebar.svelte @@ -80,7 +80,12 @@ class="text-blue-500" style="filter: hue-rotate({index * 50}deg)" /> - {prof.username} + + {prof.username} + + @{prof.instance} + + {/each} {/if}