Skip to content

Commit

Permalink
catch null
Browse files Browse the repository at this point in the history
  • Loading branch information
kchenturtles committed Dec 23, 2023
1 parent e4b97c6 commit ca4eebc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/postPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ type Items = {

export default function PostPreview({ post }: { post: Items }) {
const router = useRouter();
router.push(`/blog/${post.slug}`);
if(post.slug != null && post.slug != undefined) {
router.push(`/blog/${post.slug}`);
}

return (
<div className = {styles.preview}>
Expand Down

0 comments on commit ca4eebc

Please sign in to comment.