This commit is contained in:
@ -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...");
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user