вывод нормальной ошибки от сервера + фикс установки режима работы передатчика

This commit is contained in:
2025-01-16 13:50:01 +03:00
parent cbd2adc1c8
commit 790bfc06c2
7 changed files with 26 additions and 17 deletions

View File

@@ -13,7 +13,7 @@
this.submitStatus.{{ g['group'] }} = true
fetch('/api/set/{{ g["group"] }}', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(query) })
.then(async (resp) => { this.update{{ g['group'] | title }}Settings(await resp.json()) })
.then(async (resp) => { let vals = await resp.json(); if (vals['status'] !== 'ok') { throw new Error(vals['error'] ? vals['error'] : "Server returns undefined error") } this.update{{ g['group'] | title }}Settings(vals) })
.catch((reason) => { alert(`Ошибка при применении настроек: ${reason}`) })
.finally(() => { this.submitStatus.{{ g['group'] }} = false })
},

View File

@@ -63,6 +63,7 @@
body: JSON.stringify(query)
}).then(async (resp) => {
this.submitStatusQos = false
if (resp['error']) { throw new Error(resp['error']) }
this.updateQosSettings(await resp.json())
}).catch((reason) => {
this.submitStatusQos = false