From ded003091f626b3b15926574de50f1947acb2d7d Mon Sep 17 00:00:00 2001 From: Alexander Chabin Date: Sun, 10 Dec 2023 17:01:20 +0500 Subject: [PATCH] Change SSG to SSR in articles (#103) --- client/pages/[slug].tsx | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/client/pages/[slug].tsx b/client/pages/[slug].tsx index 2b4bfb76..359b5ddc 100644 --- a/client/pages/[slug].tsx +++ b/client/pages/[slug].tsx @@ -18,16 +18,7 @@ function ArticlePage({ title, description }: ArticleProps) { ); } -export async function getStaticPaths() { - const articles = (await articlesApi.getArticles()) || []; - - return { - paths: articles.map(({ attributes: { slug } }) => ({ params: { slug } })), - fallback: false, - }; -} - -export async function getStaticProps({ params }) { +export async function getServerSideProps({ params }) { const article = (await articlesApi.getArticle(params.slug)).at(0)?.attributes; return {