mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-02-05 10:01:24 +01:00
fix
This commit is contained in:
parent
0bca8c46f6
commit
103153ed86
2 changed files with 9 additions and 9 deletions
|
|
@ -14,7 +14,7 @@ async function saveMap(method) {
|
||||||
if (method === "dropbox") saveToDropbox(mapData, filename);
|
if (method === "dropbox") saveToDropbox(mapData, filename);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
ERROR && console.error(error);
|
ERROR && console.error(error);
|
||||||
await window.ServerAPI.postData("api/catch-error.json", error, {point: "saveMap", timestamp: Date.now()});
|
window.ServerAPI.postData("api/catch-error.json", error.toString(), {point: "saveMap", timestamp: Date.now()});
|
||||||
alertMessage.innerHTML = /* html */ `An error is occured on map saving. If the issue persists, please copy the message below and report it on ${link(
|
alertMessage.innerHTML = /* html */ `An error is occured on map saving. If the issue persists, please copy the message below and report it on ${link(
|
||||||
"https://github.com/Azgaar/Fantasy-Map-Generator/issues",
|
"https://github.com/Azgaar/Fantasy-Map-Generator/issues",
|
||||||
"GitHub"
|
"GitHub"
|
||||||
|
|
@ -168,7 +168,7 @@ function prepareMapData() {
|
||||||
async function saveToStorage(mapData, showTip = false) {
|
async function saveToStorage(mapData, showTip = false) {
|
||||||
const blob = new Blob([mapData], { type: "text/plain" });
|
const blob = new Blob([mapData], { type: "text/plain" });
|
||||||
await ldb.set("lastMap", blob);
|
await ldb.set("lastMap", blob);
|
||||||
await window.ServerAPI.postData("api/load-map.json", blob, {showTip: showTip});
|
window.ServerAPI.postData("api/load-map.json", blob, {showTip: showTip});
|
||||||
showTip && tip("Map is saved to the browser storage", false, "success");
|
showTip && tip("Map is saved to the browser storage", false, "success");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -212,7 +212,7 @@ async function initiateAutosave() {
|
||||||
lastSavedAt = Date.now();
|
lastSavedAt = Date.now();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
ERROR && console.error(error);
|
ERROR && console.error(error);
|
||||||
await window.ServerAPI.postData("api/catch-error.json", error, {point: "initiateAutosave", timestamp: Date.now()});
|
window.ServerAPI.postData("api/catch-error.json", error.toString(), {point: "initiateAutosave", timestamp: Date.now()});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ window.ServerAPI = (function () {
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("ServerAPI JSON-parse failed:", e);
|
console.debug("ServerAPI JSON-parse failed:", e);
|
||||||
ok = false;
|
ok = false;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -80,7 +80,7 @@ window.ServerAPI = (function () {
|
||||||
return { ok: false, info: text };
|
return { ok: false, info: text };
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("ServerAPI plain-parse failed:", e);
|
console.debug("ServerAPI plain-parse failed:", e);
|
||||||
ok = false;
|
ok = false;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -97,13 +97,13 @@ window.ServerAPI = (function () {
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
const payload = await readJsonSafe(res);
|
const payload = await readJsonSafe(res);
|
||||||
console.error("ServerAPI GET failed:", { url, status: res.status, payload });
|
console.debug("ServerAPI GET failed:", { url, status: res.status, payload });
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await readJsonSafe(res);
|
return await readJsonSafe(res);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("ServerAPI GET error:", { url, error });
|
console.debug("ServerAPI GET error:", { url, error });
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -123,13 +123,13 @@ window.ServerAPI = (function () {
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
const payload = await readJsonSafe(res);
|
const payload = await readJsonSafe(res);
|
||||||
console.error("ServerAPI POST failed:", { url, status: res.status, payload });
|
console.debug("ServerAPI POST failed:", { url, status: res.status, payload });
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await readJsonSafe(res);
|
return await readJsonSafe(res);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("ServerAPI POST error:", { url, error });
|
console.debug("ServerAPI POST error:", { url, error });
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue