From bb0f44d4c7182ad627534c88c540b55424b17cf9 Mon Sep 17 00:00:00 2001 From: Zhora Shalyapin Date: Wed, 26 Mar 2025 10:52:25 +0000 Subject: [PATCH] check for errors --- main.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/main.js b/main.js index 2153fdd..724e84c 100644 --- a/main.js +++ b/main.js @@ -1634,7 +1634,7 @@ (async () => { let routes = await getRoutes() - if (routes.length == 0) return + if (routes.error || routes.length == 0) return let result = Tag.div() result.append("Маршруты: ") @@ -2241,21 +2241,21 @@ function showUnknownPoints() { (async () => { let unknownPoints = await getUnknownPoints() - if (unknownPoints.length) { - let unknownPointsContainer = Tag.div() - unknownPointsContainer.append("Несохраненные точки: ") - for (const [i, cpId] of unknownPoints.entries()) { - if (i !== 0) { - unknownPointsContainer.append(", ") - } - - unknownPointsContainer.append(Tag.a({ - href: cpLink(cpId), - textContent: cpId - })) + if (unknownPoints.error || !unknownPoints.length) return + + let unknownPointsContainer = Tag.div() + unknownPointsContainer.append("Несохраненные точки: ") + for (const [i, cpId] of unknownPoints.entries()) { + if (i !== 0) { + unknownPointsContainer.append(", ") } - document.querySelector(`#content h1`).after(unknownPointsContainer) + + unknownPointsContainer.append(Tag.a({ + href: cpLink(cpId), + textContent: cpId + })) } + document.querySelector(`#content h1`).after(unknownPointsContainer) })() }