Skip to content

Commit

Permalink
fix(hot): type error
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfrosty committed Oct 26, 2023
1 parent a18e0bb commit 9ee6e98
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pages/api/content/[[...slug]].ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
allDeveloperResources,
allSolanaDocs,
allDeveloperWorkshops,
DocumentTypes,
} from "contentlayer/generated";
import type { NextApiRequest, NextApiResponse } from "next";

Expand Down Expand Up @@ -81,10 +82,11 @@ export default function handler(
if (!current) return res.status(404).json({ notFound: true });

// locate full content record
let record = records.find(
item =>

let record = (records as DocumentTypes[]).filter(
(item: DocumentTypes) =>
item._raw.sourceFilePath.toLowerCase() == current?.path?.toLowerCase(),
);
)?.[0];
if (!record) return res.status(404).json({ notFound: true });

// remove the html formatted content (since it is undesired data to send over the wire)
Expand Down

0 comments on commit 9ee6e98

Please sign in to comment.