diff --git a/src/lib/components/ui/menu/Menu.svelte b/src/lib/components/ui/menu/Menu.svelte index 1600024a..9309d52e 100644 --- a/src/lib/components/ui/menu/Menu.svelte +++ b/src/lib/components/ui/menu/Menu.svelte @@ -35,13 +35,13 @@ > {#if open} -
{#if open} - +
+ +
{/if} -
+ {/if} diff --git a/src/lib/components/ui/toasts/Toast.svelte b/src/lib/components/ui/toasts/Toast.svelte index d8dc9391..b176ba7f 100644 --- a/src/lib/components/ui/toasts/Toast.svelte +++ b/src/lib/components/ui/toasts/Toast.svelte @@ -42,7 +42,7 @@ ? ExclamationCircle : ExclamationCircle} /> -
+
{#if toast.title}

{toast.title}

{/if} diff --git a/src/lib/lemmy.ts b/src/lib/lemmy.ts index e992a0f1..7c8a03c6 100644 --- a/src/lib/lemmy.ts +++ b/src/lib/lemmy.ts @@ -7,6 +7,7 @@ import { } from 'lemmy-js-client' import { get, writable } from 'svelte/store' import { PUBLIC_PROXY_URL } from '$env/static/public' +import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js' export const DEFAULT_INSTANCE_URL = 'lemmy.world' export let instance_url = writable(DEFAULT_INSTANCE_URL) @@ -83,6 +84,10 @@ authData.subscribe(async (data) => { localStorage.setItem('user', JSON.stringify(data)) } } catch (error) { + toast({ + content: 'Failed to fetch your user. Is your instance down?', + type: ToastType.error, + }) console.error(error) authData.set(undefined) } diff --git a/src/routes/login/+page.svelte b/src/routes/login/+page.svelte index d9403900..f37cdb9a 100644 --- a/src/routes/login/+page.svelte +++ b/src/routes/login/+page.svelte @@ -25,7 +25,7 @@ try { await getClient(instance).getSite({}) } catch (err) { - throw new Error('Invalid instance URL') + throw new Error('Failed to contact that instance. Is it down?') } return true @@ -35,7 +35,7 @@ data.loading = true try { if (!(await validateURL(data.instance))) { - throw new Error('Invalid instance URL') + throw new Error('Failed to contact that instance. Is it down?') } const response = await getClient(data.instance).login({