toasts and body parse fixed

This commit is contained in:
2026-01-20 19:56:20 +00:00
parent 8486b95a45
commit c020ea968c
2 changed files with 14 additions and 5 deletions

View File

@@ -34,9 +34,12 @@
try {
fetch("/settings/changepw", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(pw_fields.value)
}).then(async (response) => {
const body = await response.json()
if (response.ok) {
toast.add({
title: "Done!",
@@ -45,9 +48,11 @@
})
}
else {
const body = await response.json()
console.log(body)
toast.add({
title: 'Error',
description : body.statusMessage || body.message || 'Something went wrong',
description : body.data.detail || 'Something went wrong',
color: 'error'
})
}