Migrate articles to standalone endpoints
This commit is contained in:
parent
fecdeee94d
commit
5f1c7e9804
@ -1,5 +1,5 @@
|
||||
/** @type {import('@sveltejs/kit').ParamMatcher} */
|
||||
export function match(param: string) {
|
||||
console.log('parma', param)
|
||||
console.debug('parma', param)
|
||||
return !['tags', 'page'].some((keyword) => param.startsWith(keyword))
|
||||
}
|
||||
|
@ -3,14 +3,12 @@
|
||||
import type { LoadInput, LoadOutput } from '@sveltejs/kit/types/page'
|
||||
|
||||
export async function load({ fetch, url }: LoadInput): Promise<LoadOutput> {
|
||||
const blogPostsResponse = await fetch(`/blog`, {
|
||||
headers: { accept: 'application/json' },
|
||||
})
|
||||
const blogPostsResponse = await fetch(`/blog/articles`)
|
||||
const blogPostsContent = await blogPostsResponse.json()
|
||||
return {
|
||||
props: {
|
||||
latestPosts: take(5, blogPostsContent.posts),
|
||||
// TODO Check if not bugged
|
||||
// TODO Check if not bugged FIXME
|
||||
segment: '',
|
||||
},
|
||||
}
|
||||
|
@ -1,3 +1,15 @@
|
||||
<script lang="ts" context="module">
|
||||
/**
|
||||
* @type {import('@sveltejs/kit').Load}
|
||||
*/
|
||||
export async function load({ fetch }) {
|
||||
const articleResponse = await fetch(`/blog/articles`)
|
||||
.then((r) => r.json())
|
||||
|
||||
return { props: { posts: articleResponse.posts } }
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import ArticleFooter from '../../components/blog/ArticleFooter.svelte'
|
||||
import { postListClass, seeAllClass } from './index.css'
|
||||
|
Loading…
Reference in New Issue
Block a user