Introduce segments for blog posts and filter them
This commit is contained in:
@ -8,6 +8,7 @@ import type { RequestHandler } from './$types'
|
||||
|
||||
export const prerender = true
|
||||
export const GET = (async ({ params }) => {
|
||||
console.log(params);
|
||||
const handledParams = params.params === 'index' ? '' : params.params
|
||||
const { page = 1, pageSize = 7, ...filters } = parseParams(handledParams)
|
||||
const paginationParams = getDropTakeFromPageParams(
|
||||
|
@ -6,9 +6,8 @@ import type { PaginationResult } from '$lib/pagination/pagination'
|
||||
export const load = (async ({ fetch, params }) => {
|
||||
const { page = 1, pageSize = 7, ...filters } = parseParams(params.params)
|
||||
const articleResponse = await fetch(
|
||||
`/articles/${params.params ? params.params : 'index'}.json`
|
||||
`/articles/segments/blog${params.params ? `/${params.params}` : ''}.json`
|
||||
).then((r) => r.json())
|
||||
|
||||
return {
|
||||
posts: articleResponse.posts as PaginationResult<ArticleContent>,
|
||||
page: Number(page),
|
||||
|
@ -6,7 +6,7 @@ import type { PaginationResult } from '$lib/pagination/pagination'
|
||||
export const load = (async ({ fetch, params }) => {
|
||||
const { page = 1, pageSize = 7, ...filters } = parseParams(params.params)
|
||||
const articleResponse = await fetch(
|
||||
`/articles/${params.params ? params.params : 'index'}.json`
|
||||
`/articles/segments/broadcasts${params.params ? `/${params.params}` : ''}.json`
|
||||
).then((r) => r.json())
|
||||
|
||||
return {
|
||||
|
Reference in New Issue
Block a user