Update
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
soraefir
2025-05-15 00:35:39 +02:00
parent d1c4a23e26
commit 09b9830fd0
4 changed files with 16 additions and 12 deletions

View File

@ -41,8 +41,9 @@ export const load = (id: string) =>
return res;
});
export const save = (id: string, v: journey) =>
fetch("/api/" + id, { method: "post", body: JSON.stringify(v) })
export const save = async (id: string, v: journey) => {
v.version +=1;
return fetch("/api/" + id, { method: "post", body: JSON.stringify(v) })
.then((res) => {
if (!res.ok) throw new Error("Error " + res.statusText);
return res.json();
@ -50,6 +51,7 @@ export const save = (id: string, v: journey) =>
.then((_res) => {
console.log("Saved...");
});
}
export const query_nominatim = (
q: string,

View File

@ -35,6 +35,7 @@ declare global {
interface journey {
fmt_ver: number
version: number
title: string
main: leg[]
}
@ -52,6 +53,7 @@ const leg_template: leg = {
}
const journey_template: journey = {
fmt_ver: 1,
version: 0,
title: "New Journey",
main: [leg_template],
}

View File

@ -10,6 +10,7 @@ function migrate_A_to_0(e: journey): journey {
v.travel = v.travel || [];
v.day_title = typeof (v.day_title) == "string" ? [v.day_title] : []
})
e.version = e.version || 0;
console.log(e)
return e;
}