fix: data non external

This commit is contained in:
Artemy 2024-01-24 13:34:57 +03:00
parent de3a212dbb
commit d6fca4a08e

View file

@ -31,7 +31,7 @@ window.onload = async () => {
const mapId = params.id || "worldMap"; const mapId = params.id || "worldMap";
info("Loading", mapId); info("Loading", mapId);
let mIdData = ( let mData = (
await ( await (
await fetch( await fetch(
`https://raw.githubusercontent.com/CIMEngine/MapList/main/index.json` `https://raw.githubusercontent.com/CIMEngine/MapList/main/index.json`
@ -39,17 +39,13 @@ window.onload = async () => {
).json() ).json()
)[mapId]; )[mapId];
if (!mIdData) { if (!mData) {
error(`Map "${mapId}" not found`); error(`Map "${mapId}" not found`);
} }
let mData = {}; if (params.external || mData.external) {
info("Getting data from external", params.external || mData.external);
mData.external = params.external || mIdData.external; mData = await (await fetch(params.external || mData.external)).json();
if (mData.external) {
info("Getting data from external", mData.external);
mData = await (await fetch(mData.external)).json();
} }
mData.geoURL = params.geoURL || mData.geoURL; mData.geoURL = params.geoURL || mData.geoURL;