adds svelte API
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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};
|
||||
};
|
||||
Reference in New Issue
Block a user