mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-02-05 18:11:23 +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);
|
||||
} catch (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(
|
||||
"https://github.com/Azgaar/Fantasy-Map-Generator/issues",
|
||||
"GitHub"
|
||||
|
|
@ -168,7 +168,7 @@ function prepareMapData() {
|
|||
async function saveToStorage(mapData, showTip = false) {
|
||||
const blob = new Blob([mapData], { type: "text/plain" });
|
||||
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");
|
||||
}
|
||||
|
||||
|
|
@ -212,7 +212,7 @@ async function initiateAutosave() {
|
|||
lastSavedAt = Date.now();
|
||||
} catch (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;
|
||||
|
||||
} catch (e) {
|
||||
console.error("ServerAPI JSON-parse failed:", e);
|
||||
console.debug("ServerAPI JSON-parse failed:", e);
|
||||
ok = false;
|
||||
return null;
|
||||
}
|
||||
|
|
@ -80,7 +80,7 @@ window.ServerAPI = (function () {
|
|||
return { ok: false, info: text };
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("ServerAPI plain-parse failed:", e);
|
||||
console.debug("ServerAPI plain-parse failed:", e);
|
||||
ok = false;
|
||||
return null;
|
||||
}
|
||||
|
|
@ -97,13 +97,13 @@ window.ServerAPI = (function () {
|
|||
|
||||
if (!res.ok) {
|
||||
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 await readJsonSafe(res);
|
||||
} catch (error) {
|
||||
console.error("ServerAPI GET error:", { url, error });
|
||||
console.debug("ServerAPI GET error:", { url, error });
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -123,13 +123,13 @@ window.ServerAPI = (function () {
|
|||
|
||||
if (!res.ok) {
|
||||
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 await readJsonSafe(res);
|
||||
} catch (error) {
|
||||
console.error("ServerAPI POST error:", { url, error });
|
||||
console.debug("ServerAPI POST error:", { url, error });
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue