Skip to content

Commit

Permalink
fix: vote in comment thread
Browse files Browse the repository at this point in the history
  • Loading branch information
olexh committed May 16, 2024
1 parent 0c9da0c commit 1238ba9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import Content from './components/content';
import ContentHeader from './components/content-header';
import { getContent } from './components/useContent';


export async function generateMetadata(): Promise<Metadata> {
return _generateMetadata({
title: `Коментарі`,
Expand Down Expand Up @@ -73,11 +72,12 @@ const CommentsPage: FC<Props> = async ({ params }) => {
comment_reference &&
(await queryClient.prefetchQuery({
queryKey: ['commentThread', comment_reference],
queryFn: () =>
queryFn: ({ meta }) =>
getCommentThread({
params: {
reference: comment_reference,
},
auth: meta?.auth,
}),
}));

Expand Down
5 changes: 4 additions & 1 deletion components/comments/components/comment-vote.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from 'react';
import { FC } from 'react';
import BxBxsDownvote from '~icons/bx/bxs-downvote';
import BxBxsUpvote from '~icons/bx/bxs-upvote';
import BxDownvote from '~icons/bx/downvote';
Expand All @@ -24,6 +24,9 @@ const CommentVote: FC<Props> = ({ comment }) => {
mutationFn: vote,
onSuccess: async () => {
await queryClient.invalidateQueries({ queryKey: ['comments'] });
await queryClient.invalidateQueries({
queryKey: ['commentThread'],
});
},
});

Expand Down

0 comments on commit 1238ba9

Please sign in to comment.