Skip to content

Commit b828437

Browse files
committed
fix: destructure params
1 parent 25ed5d4 commit b828437

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sveltekit-app/src/routes/post/[slug]/+page.server.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import type {PageServerLoad} from './$types'
33

44
export const load: PageServerLoad = async ({locals, params}) => {
55
const {loadQuery} = locals.sanity
6-
const initial = await loadQuery<Post>(query, params)
6+
const {slug} = params
7+
const initial = await loadQuery<Post>(query, {slug})
78

89
// We pass the data in a format that is easy for `useQuery` to consume in the
910
// corresponding `+page.svelte` file, but you can return the data in any
1011
// format you like.
1112
return {
1213
query,
13-
params,
14+
params: {slug},
1415
options: {initial},
1516
}
1617
}

0 commit comments

Comments
 (0)