mirror of
https://github.com/CIMEngine/map.git
synced 2024-11-05 20:13:58 +03:00
fix: data non external
This commit is contained in:
parent
de3a212dbb
commit
d6fca4a08e
1 changed files with 5 additions and 9 deletions
14
src/index.js
14
src/index.js
|
@ -31,7 +31,7 @@ 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`
|
||||
|
@ -39,17 +39,13 @@ window.onload = async () => {
|
|||
).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;
|
||||
|
|
Loading…
Reference in a new issue