add check for collection link

Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
Chloe 2024-07-04 09:15:57 +07:00
parent 37c603f64b
commit 6729bbd80c
No known key found for this signature in database
GPG Key ID: CFD53CE570D42DF5
2 changed files with 4 additions and 2 deletions

View File

@ -7,10 +7,12 @@ const CollectionLink = async ({
anchorText,
className
}: {
collectionLinkId: string;
collectionLinkId?: string;
anchorText: string;
className?: string;
}) => {
if (!collectionLinkId) return null;
const collection = await getCollection({ id: collectionLinkId });
if (!collection) return null;

View File

@ -12,7 +12,7 @@ const HelpfulLinks = async ({ ids }: { ids: string[] | null }) => {
{links.map((link) => (
<CollectionLink
key={link.id}
collectionLinkId={link.collection_link!}
collectionLinkId={link.collection_link}
anchorText={link.anchor_text!}
className="rounded border border-gray-600 px-3 py-1 text-sm"
/>