From c2150b4348ebe959c0ba23fb743f2f56da90b5cc Mon Sep 17 00:00:00 2001 From: "Sean R. Abraham" Date: Wed, 19 Feb 2025 09:20:49 -0500 Subject: [PATCH] fix error-handling on an API call destructuring is quirky... --- src/ims/element/static/field_report.js | 2 +- src/ims/element/static/field_reports.js | 1 + src/ims/element/static/incidents.js | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ims/element/static/field_report.js b/src/ims/element/static/field_report.js index 6f304a1fd..122242473 100644 --- a/src/ims/element/static/field_report.js +++ b/src/ims/element/static/field_report.js @@ -335,7 +335,7 @@ async function makeIncident() { const attachToIncidentUrl = `${urlReplace(url_fieldReports)}${fieldReport.number}` + `?action=attach;incident=${fieldReport.incident}`; - let {attachErr} = await fetchJsonNoThrow(attachToIncidentUrl, { + const {err: attachErr} = await fetchJsonNoThrow(attachToIncidentUrl, { body: {}, }); if (attachErr != null) { diff --git a/src/ims/element/static/field_reports.js b/src/ims/element/static/field_reports.js index f41c33d9f..cc414eadf 100644 --- a/src/ims/element/static/field_reports.js +++ b/src/ims/element/static/field_reports.js @@ -77,6 +77,7 @@ function initFieldReportsTable() { // Fire-and-forget this promise, since it tries forever to acquire a lock let ignoredPromise = requestEventSourceLock(); + const fieldReportChannel = new BroadcastChannel(fieldReportChannelName); fieldReportChannel.onmessage = function (e) { if (e.data["update_all"]) { diff --git a/src/ims/element/static/incidents.js b/src/ims/element/static/incidents.js index 49b1b6819..1302bd259 100644 --- a/src/ims/element/static/incidents.js +++ b/src/ims/element/static/incidents.js @@ -124,6 +124,7 @@ function initIncidentsTable() { // Fire-and-forget this promise, since it tries forever to acquire a lock let ignoredPromise = requestEventSourceLock(); + const incidentChannel = new BroadcastChannel(incidentChannelName); incidentChannel.onmessage = async function (e) { if (e.data["update_all"]) {