Skip to content

Commit

Permalink
Merge pull request #249 from Boye95/dev
Browse files Browse the repository at this point in the history
fix: properly render bookmark cards when bookmarked resources has been deleted
  • Loading branch information
Boye95 committed Aug 1, 2023
2 parents 0795fdc + bd90c3e commit 3e07db7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/pages/dashboard/pages/bookmarks/bookmarkCard/bookmarkCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const bookmarkcard = ({ bookmark }) => {
{showDeleteBookmarkModal && (
<DeleteBookmarkModal
handleToggleDeleteBookmarkModal={handleToggleDeleteBookmarkModal}
bookmarkId={bookmark._id}
bookmarkId={bookmark?._id}
/>
)}
<div className={bookmarkCardStyles.tableContent}>
Expand All @@ -28,13 +28,13 @@ const bookmarkcard = ({ bookmark }) => {
<Link
to={
bookmark.postType == 'Post'
? `/dashboard/post/${bookmark.post._id}`
? `/dashboard/feed/post/${bookmark.post?._id}`
: bookmark.postType == 'Comment'
? `/dashboard/post/${bookmark.post?.post}`
? `/dashboard/feed/post/${bookmark.post?.post}`
: bookmark.postType == 'Question'
? `/dashboard/community/question/${bookmark?.post._id}/${bookmark?.post.slug}`
? `/dashboard/community/question/${bookmark?.post?._id}/${bookmark?.post?.slug}`
: bookmark.postType == 'Answer'
? `/dashboard/community/question/${bookmark?.post.question._id}/${bookmark?.post.question.slug}`
? `/dashboard/community/question/${bookmark?.post?.question?._id}/${bookmark?.post?.question?.slug}`
: ' '
}
className={bookmarkCardStyles.titleLink}
Expand All @@ -46,16 +46,16 @@ const bookmarkcard = ({ bookmark }) => {
<div className={bookmarkCardStyles.post}>
<p>
<span className={bookmarkCardStyles.poster}>
{bookmark.post.author.firstName}{' '}
{bookmark.post.author.lastName}
{bookmark?.post?.author?.firstName}{' '}
{bookmark?.post?.author?.lastName}
</span>{' '}
<span className={bookmarkCardStyles.dated}>
{
{bookmark?.post && (
<ReactTimeAgo
date={bookmark.post.createdAt}
date={bookmark?.post?.createdAt}
locale="en-US"
/>
}
)}
</span>
</p>
</div>
Expand Down

0 comments on commit 3e07db7

Please sign in to comment.