From 5926eb53ba87139213e9ad10cd190acc7ebe1130 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Fri, 26 Jan 2024 09:39:18 +0100 Subject: [PATCH] chore: catch error in getMore --- umap/templates/umap/content.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/umap/templates/umap/content.html b/umap/templates/umap/content.html index 6647095d..ecabe18c 100644 --- a/umap/templates/umap/content.html +++ b/umap/templates/umap/content.html @@ -41,12 +41,14 @@ const server = new window.umap.ServerRequest(ui) const getMore = async function (e) { L.DomEvent.stop(e) - const [{html}, response] = await server.get(this.href) - const container = this.parentNode - container.innerHTML = html - const more = document.querySelector('.more_button') - if (more) { - L.DomEvent.on(more, 'click', getMore, more) + const [{html}, response, error] = await server.get(this.href) + if (!error) { + const container = this.parentNode + container.innerHTML = html + const more = document.querySelector('.more_button') + if (more) { + L.DomEvent.on(more, 'click', getMore, more) + } } } const more = document.querySelector('.more_button')