adds api gpx upload route
This commit is contained in:
@@ -13,7 +13,6 @@ export async function GET(event: RequestEvent) {
|
||||
} catch (e: any) {
|
||||
throw error(e.status, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export async function PUT(event: RequestEvent) {
|
||||
|
||||
@@ -2,6 +2,16 @@ import { pb } from "$lib/pocketbase";
|
||||
import { error, json, type RequestEvent } from "@sveltejs/kit";
|
||||
import type { List } from "postcss/lib/list";
|
||||
|
||||
export async function GET(event: RequestEvent) {
|
||||
try {
|
||||
const r = await pb.collection('lists')
|
||||
.getOne<List>(event.params.id as string, { expand: "trails,trails.waypoints,trails.category" })
|
||||
return json(r)
|
||||
} catch (e: any) {
|
||||
throw error(e.status, e);
|
||||
}
|
||||
}
|
||||
|
||||
export async function POST(event: RequestEvent) {
|
||||
const data = await event.request.json()
|
||||
|
||||
@@ -16,7 +26,7 @@ export async function POST(event: RequestEvent) {
|
||||
export async function DELETE(event: RequestEvent) {
|
||||
try {
|
||||
const r = await pb.collection('lists').delete(event.params.id as string)
|
||||
return json(r);
|
||||
return json({ 'acknowledged': r });
|
||||
} catch (e: any) {
|
||||
throw error(e.status, e)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user