fix: infinite loading spinner if passwords dont match

This commit is contained in:
Xyphyn committed 2023-09-26 19:07:47 -07:00
1 parent 497496f92a
commit baea03a3c3
2 files changed
+10 -5

No files matched your search

@@ -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
}