finishes trail create

This commit is contained in:
Christian Beutel
2024-01-29 21:30:54 +01:00
parent 2d4c673060
commit efaf0d4e5c
47 changed files with 1739 additions and 130 deletions

View File

@@ -23,6 +23,31 @@ export async function trails_show(id: string, loadGPX?: boolean) {
trail.set(response);
}
export async function trails_create(bodyParams?: { [key: string]: any; } | FormData) {
const model = await pb
.collection("trails")
.create<Trail>(bodyParams);
return model;
}
export async function trails_update(id: string, bodyParams?: { [key: string]: any; } | FormData) {
const model = await pb
.collection("trails")
.update<Trail>(id, bodyParams);
return model;
}
export async function trails_delete(id: string) {
const success = await pb
.collection("trails")
.delete(id);
return success;
}
async function fetchGPX(trail: Trail) {
if (!trail.gpx) {
return "";