Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete return from notFound()
Browse files Browse the repository at this point in the history
ProchaLu committed Mar 5, 2024

Verified

This commit was signed with the committer’s verified signature.
adamzelycz Adam Zelycz
1 parent d783dd7 commit 9b10517
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
@@ -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} />;

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

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

return {
@@ -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;
2 changes: 1 addition & 1 deletion app/[contentType]/tags/[tag]/page.tsx
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ export default function ContentListPage({
const contentTypeData = contentTypesMap.get(contentType);

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

const { title, description, path } = contentTypeData;

0 comments on commit 9b10517

Please sign in to comment.