Skip to content

Commit

Permalink
fix: data non external
Browse files Browse the repository at this point in the history
  • Loading branch information
artegoser committed Jan 24, 2024
1 parent de3a212 commit d6fca4a
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,21 @@ window.onload = async () => {
const mapId = params.id || "worldMap";

info("Loading", mapId);
let mIdData = (
let mData = (
await (
await fetch(
`https://raw.githubusercontent.com/CIMEngine/MapList/main/index.json`
)
).json()
)[mapId];

if (!mIdData) {
if (!mData) {
error(`Map "${mapId}" not found`);
}

let mData = {};

mData.external = params.external || mIdData.external;

if (mData.external) {
info("Getting data from external", mData.external);
mData = await (await fetch(mData.external)).json();
if (params.external || mData.external) {
info("Getting data from external", params.external || mData.external);
mData = await (await fetch(params.external || mData.external)).json();
}

mData.geoURL = params.geoURL || mData.geoURL;
Expand Down

0 comments on commit d6fca4a

Please sign in to comment.