This commit is contained in:
@ -41,14 +41,17 @@ export const load = (id: string) =>
|
|||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var version_add = 1
|
||||||
export const save = async (id: string, v: journey) => {
|
export const save = async (id: string, v: journey) => {
|
||||||
v.version +=1;
|
let body = JSON.parse(JSON.stringify(v))
|
||||||
return fetch("/api/" + id, { method: "post", body: JSON.stringify(v) })
|
body.version +=version_add;
|
||||||
|
return fetch("/api/" + id, { method: "post", body: JSON.stringify(body) })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (!res.ok) throw new Error("Error " + res.statusText);
|
if (!res.ok) throw new Error("Error " + res.statusText);
|
||||||
return res.json();
|
return res.json();
|
||||||
})
|
})
|
||||||
.then((_res) => {
|
.then((_res) => {
|
||||||
|
version_add+=1;
|
||||||
console.log("Saved...");
|
console.log("Saved...");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user