adds trail link sharing

This commit is contained in:
Christian Beutel
2025-08-20 16:51:33 +02:00
parent b3d44f3b78
commit 1e22c78c22
36 changed files with 598 additions and 36 deletions

View File

@@ -6,7 +6,7 @@ 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 }) => {
export const load: Load = async ({ params, fetch, url }) => {
const user = get(currentUser)
if (!params.id) {
@@ -19,7 +19,7 @@ export const load: Load = async ({ params, fetch }) => {
if (params.id === "new") {
trail = new Trail("", { category: categories[0] });
} else {
trail = await trails_show(params.id, undefined, true, fetch);
trail = await trails_show(params.id, undefined, url.searchParams.get("share") ?? undefined, true, fetch);
}
return { trail: trail, lists: lists }

View File

@@ -2,9 +2,9 @@ import { trails_show } from "$lib/stores/trail_store";
import { APIError } from "$lib/util/api_util";
import { error, type Load, type NumericRange } from "@sveltejs/kit";
export const load: Load = async ({ params, fetch }) => {
export const load: Load = async ({ params, fetch, url }) => {
try {
const trail = await trails_show(params.id!, params.handle, true, fetch)
const trail = await trails_show(params.id!, params.handle, url.searchParams.get("share") ?? undefined, true, fetch)
return { trail }
} catch (e) {