From ffce6aeb51070bf04612f110f1f6461de0a4d7d7 Mon Sep 17 00:00:00 2001 From: Artemy Date: Tue, 23 Jan 2024 20:41:05 +0300 Subject: [PATCH] refactor: external parsing --- src/index.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index aad0421..c62d449 100644 --- a/src/index.js +++ b/src/index.js @@ -42,20 +42,16 @@ window.onload = async () => { ).json() )[mapId]; - if (mIdData.external) { - mIdData = await (await fetch(mIdData.external)).json(); - } - if (!mIdData) { alert(`Map ${mapId} not found`); } let mData = {}; - if (params.external) { - const data = await (await fetch(params.external)).json(); + mData.external = params.external || mIdData.external; - mData.geoURL = data.geoURL; + if (mData.external) { + mData = await (await fetch(mData.external)).json(); } mData.geoURL = params.geoURL || mIdData.geoURL;