race condition security patch
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
import { ExpandType } from "$lib/models/list";
|
||||
import { Trail } from "$lib/models/trail";
|
||||
import { pb } from "$lib/pocketbase";
|
||||
import { categories_index } from "$lib/stores/category_store";
|
||||
import { lists_index } from "$lib/stores/list_store";
|
||||
import { trails_show } from "$lib/stores/trail_store";
|
||||
import { currentUser } from "$lib/stores/user_store";
|
||||
import { error, type Load } from "@sveltejs/kit";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
export const load: Load = async ({ params, fetch }) => {
|
||||
const user = get(currentUser)
|
||||
|
||||
if (!params.id) {
|
||||
return error(400, "Bad Request")
|
||||
}
|
||||
const categories = await categories_index(fetch)
|
||||
const lists = await lists_index({ q: "", author: pb.authStore.record?.id ?? "" }, 1, -1, fetch, ExpandType.None)
|
||||
|
||||
const lists = await lists_index({ q: "", author: user?.id ?? "" }, 1, -1, fetch, ExpandType.None)
|
||||
|
||||
let trail: Trail;
|
||||
if (params.id === "new") {
|
||||
trail = new Trail("", { category: categories[0] });
|
||||
|
||||
Reference in New Issue
Block a user