From 5f1c7e9804afbe4164c3619545e32089b65fe476 Mon Sep 17 00:00:00 2001 From: Michal Vanko Date: Thu, 24 Mar 2022 18:38:53 +0100 Subject: [PATCH] Migrate articles to standalone endpoints --- src/params/blogPage.ts | 2 +- src/routes/__layout.svelte | 6 ++---- src/routes/blog/[...params].svelte | 12 ++++++++++++ src/routes/blog/{[...params].ts => articles.ts} | 0 4 files changed, 15 insertions(+), 5 deletions(-) rename src/routes/blog/{[...params].ts => articles.ts} (100%) diff --git a/src/params/blogPage.ts b/src/params/blogPage.ts index 77f42c8..aec7801 100644 --- a/src/params/blogPage.ts +++ b/src/params/blogPage.ts @@ -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)) } diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index d9bc134..09c7c21 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -3,14 +3,12 @@ import type { LoadInput, LoadOutput } from '@sveltejs/kit/types/page' export async function load({ fetch, url }: LoadInput): Promise { - 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: '', }, } diff --git a/src/routes/blog/[...params].svelte b/src/routes/blog/[...params].svelte index 806d017..699ddf2 100644 --- a/src/routes/blog/[...params].svelte +++ b/src/routes/blog/[...params].svelte @@ -1,3 +1,15 @@ + +