From 38d895a95954b41ab4c9d9d3bc63d0db06b992c7 Mon Sep 17 00:00:00 2001 From: soraefir Date: Thu, 15 May 2025 00:55:06 +0200 Subject: [PATCH] WIP --- src/client/api.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/api.ts b/src/client/api.ts index 9bb7386..f004f8b 100644 --- a/src/client/api.ts +++ b/src/client/api.ts @@ -41,14 +41,17 @@ export const load = (id: string) => return res; }); +var version_add = 1 export const save = async (id: string, v: journey) => { - v.version +=1; - return fetch("/api/" + id, { method: "post", body: JSON.stringify(v) }) + let body = JSON.parse(JSON.stringify(v)) + body.version +=version_add; + return fetch("/api/" + id, { method: "post", body: JSON.stringify(body) }) .then((res) => { if (!res.ok) throw new Error("Error " + res.statusText); return res.json(); }) .then((_res) => { + version_add+=1; console.log("Saved..."); }); }