Skip to content

Commit

Permalink
Change SSG to SSR in articles (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
sashachabin authored Dec 10, 2023
1 parent 821d10f commit ded0030
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions client/pages/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ded0030

Please sign in to comment.