Skip to content

Commit

Permalink
fix: implement type safety fallback (#2933)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lelith authored Nov 15, 2024
1 parent 91c2d99 commit 6cf1dcc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/website/pages/[...slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,12 @@ export const getStaticPaths: GetStaticPaths = async () => {
?.sectionCollection?.items[0];
}

const sectionSlug = section?.slug ?? 'default-section';
const itemSlug = item?.slug ?? 'default-item';
const slug = item.authProtected
? [section.slug, 'protected', item.slug]
: [section.slug, item.slug];
? [sectionSlug, 'protected', itemSlug]
: [sectionSlug, itemSlug];

return {
params: {
slug,
Expand Down

0 comments on commit 6cf1dcc

Please sign in to comment.