diff --git a/src/components/Author/AuthorRatingControl.tsx b/src/components/Author/AuthorRatingControl.tsx index 0e1902f4..7591267e 100644 --- a/src/components/Author/AuthorRatingControl.tsx +++ b/src/components/Author/AuthorRatingControl.tsx @@ -19,10 +19,12 @@ export const AuthorRatingControl = (props: AuthorRatingControlProps) => { // eslint-disable-next-line unicorn/consistent-function-scoping const handleRatingChange = async (isUpvote: boolean) => { console.log('handleRatingChange', { isUpvote }) - await apiClient.rateAuthor({ rated_slug: props.author.slug, value: isUpvote ? 1 : -1 }) + if (props.author?.slug) { + await apiClient.rateAuthor({ rated_slug: props.author?.slug, value: isUpvote ? 1 : -1 }) + } } - const [rating, setRating] = createSignal(props.author.stat.rating) + const [rating, setRating] = createSignal(props.author?.stat?.rating) return (