fix: infinite loading spinner if passwords dont match
This commit is contained in:
1 parent
497496f92a
commit
baea03a3c3
2 files changed
+10
-5
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "photon-lemmy",
|
"name": "photon-lemmy",
|
||||||
"version": "1.13.1",
|
"version": "1.13.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
let loading = false
|
let loading = false
|
||||||
|
|
||||||
async function submit() {
|
async function submit() {
|
||||||
loading = true
|
try {
|
||||||
const res = await trycatch(async () => {
|
|
||||||
if (!$profile?.jwt) return
|
if (!$profile?.jwt) return
|
||||||
|
loading = true
|
||||||
const res = await getClient().changePassword({
|
const res = await getClient().changePassword({
|
||||||
auth: $profile?.jwt,
|
auth: $profile?.jwt,
|
||||||
new_password: newPassword,
|
new_password: newPassword,
|
||||||
@@ -30,9 +30,14 @@
|
|||||||
} else {
|
} else {
|
||||||
throw new Error('Invalid credentials')
|
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
|
loading = false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user