From baea03a3c3220da335bca18772aa12deefb17487 Mon Sep 17 00:00:00 2001 From: Xyphyn Date: Tue, 26 Sep 2023 19:07:47 -0700 Subject: [PATCH] fix: infinite loading spinner if passwords dont match --- package.json | 2 +- .../profile/(local_user)/password/+page.svelte | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 225f7290..f6575d98 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "photon-lemmy", - "version": "1.13.1", + "version": "1.13.2", "private": true, "scripts": { "dev": "vite dev", diff --git a/src/routes/profile/(local_user)/password/+page.svelte b/src/routes/profile/(local_user)/password/+page.svelte index 3e225c33..f92b9ed1 100644 --- a/src/routes/profile/(local_user)/password/+page.svelte +++ b/src/routes/profile/(local_user)/password/+page.svelte @@ -11,9 +11,9 @@ let loading = false async function submit() { - loading = true - const res = await trycatch(async () => { + try { if (!$profile?.jwt) return + loading = true const res = await getClient().changePassword({ auth: $profile?.jwt, new_password: newPassword, @@ -30,9 +30,14 @@ } else { throw new Error('Invalid credentials') } - }) - if (res) toast({ content: 'Successfully changed your password. ' }) + toast({ content: 'Successfully changed your password. ' }) + } catch (e) { + toast({ + content: e as any, + type: 'error', + }) + } loading = false }