adds trail link sharing
This commit is contained in:
@@ -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 }
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user