diff --git a/app/pages/settings/general.vue b/app/pages/settings/general.vue index 6352964..35e976f 100644 --- a/app/pages/settings/general.vue +++ b/app/pages/settings/general.vue @@ -23,13 +23,16 @@ loading_btn.value = true await fetch("/settings/edit_user", { method: "POST", + headers: { + "Content-Type": "application/json" + }, body: JSON.stringify({ first_name: user_data.value.first_name, last_name: user_data.value.last_name, email: user_data.value.email }) - }).then(async (response) => { - const body = await response.json() + }).then(async response => { + if (response.ok) { toast.add({ title: "Done!", @@ -38,9 +41,10 @@ }) } else { + const body = await response.json() toast.add({ title: 'Error', - description : body.statusMessage || body.message || 'Something went wrong', + description : body.data.detail || 'Something went wrong', color: 'error' }) } diff --git a/app/pages/settings/security.vue b/app/pages/settings/security.vue index 8c24f9c..d6a51f6 100644 --- a/app/pages/settings/security.vue +++ b/app/pages/settings/security.vue @@ -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' }) }