adds svelte API

This commit is contained in:
Christian Beutel
2024-03-09 16:46:02 +01:00
parent 33c3b273ab
commit 1b493f576e
114 changed files with 1574 additions and 2528 deletions

View File

@@ -30,16 +30,16 @@
}
async function saveList(
e: CustomEvent<{ list: List; formData: FormData }>,
e: CustomEvent<{ list: List; avatar?: File }>,
) {
const result = e.detail;
if (result.list.id) {
await lists_update(result.list, result.formData);
await lists_index();
await lists_update(result.list, result.avatar);
} else {
await lists_create(result.formData);
await lists_index();
await lists_create(result.list, result.avatar);
}
await lists_index();
}
async function handleDropdownClick(

View File

@@ -2,7 +2,7 @@ import type { TrailFilter } from "$lib/models/trail";
import { lists_index } from "$lib/stores/list_store";
import type { Load } from "@sveltejs/kit";
export const load: Load = async ({ params }) => {
export const load: Load = async ({ params, fetch }) => {
const filter: TrailFilter = {
q: "",
category: [],
@@ -16,7 +16,7 @@ export const load: Load = async ({ params }) => {
sort: "created",
sortOrder: "+",
};
await lists_index();
await lists_index(undefined, fetch);
return {filter};
};