Skip to content

Commit

Permalink
Delete return from notFound()
Browse files Browse the repository at this point in the history
  • Loading branch information
ProchaLu committed Mar 5, 2024
1 parent d783dd7 commit 9b10517
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/[contentType]/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ export default async function ContentPage({ params }: { params: Params }) {
const { slug, contentType } = params;

if (!contentTypesMap.has(contentType)) {
return notFound();
notFound();
}

const content = await fetchContentData(slug, contentType);
if (content.draft) return notFound();
if (content.draft) notFound();

if (contentType === 'works') return <WorkPage work={content} />;

Expand Down
6 changes: 3 additions & 3 deletions app/[contentType]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function generateMetadata({ params }: { params: Params }): Metadata {
const contentType = contentTypesMap.get(params.contentType);

if (!contentType) {
return notFound();
notFound();
}

return {
Expand All @@ -45,15 +45,15 @@ export default function ContentListPage({ params }: { params: Params }) {

// redirect to 404 with wrong contentType
if (!contentTypesMap.has(contentType)) {
return notFound();
notFound();
}

const content = getContentList(contentType);
const isNotes = contentType.toLowerCase() === 'notes';
const contentTypeData = contentTypesMap.get(contentType);

if (!contentTypeData) {
return notFound();
notFound();
}

const { title, description, path } = contentTypeData;
Expand Down
2 changes: 1 addition & 1 deletion app/[contentType]/tags/[tag]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function ContentListPage({
const contentTypeData = contentTypesMap.get(contentType);

if (!contentTypeData) {
return notFound();
notFound();
}

const { title, description, path } = contentTypeData;
Expand Down

0 comments on commit 9b10517

Please sign in to comment.