From 029c78c8ab49788b41f097e22ed268cb5f427239 Mon Sep 17 00:00:00 2001 From: MTG2000 Date: Mon, 6 Jun 2022 17:46:55 +0300 Subject: [PATCH] fix: connect vote button in post actions --- src/features/Auth/pages/LoginPage/LoginPage.tsx | 5 +++++ .../Components/PostActions/PostActions.tsx | 10 ++++++++-- .../Components/StoryPageContent/useUpdateStory.tsx | 3 ++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/features/Auth/pages/LoginPage/LoginPage.tsx b/src/features/Auth/pages/LoginPage/LoginPage.tsx index e3017d5..bd41ad9 100644 --- a/src/features/Auth/pages/LoginPage/LoginPage.tsx +++ b/src/features/Auth/pages/LoginPage/LoginPage.tsx @@ -1,4 +1,5 @@ import { useEffect, useState } from "react" +import { Helmet } from "react-helmet"; import { BsFillLightningChargeFill } from "react-icons/bs"; import { Grid } from "react-loader-spinner"; import { useNavigate } from "react-router-dom"; @@ -99,6 +100,10 @@ export default function LoginPage() { return (
+ + {`makers.bolt.fun`} + + {content}
) diff --git a/src/features/Posts/pages/PostDetailsPage/Components/PostActions/PostActions.tsx b/src/features/Posts/pages/PostDetailsPage/Components/PostActions/PostActions.tsx index 3aa5f1d..072532d 100644 --- a/src/features/Posts/pages/PostDetailsPage/Components/PostActions/PostActions.tsx +++ b/src/features/Posts/pages/PostDetailsPage/Components/PostActions/PostActions.tsx @@ -25,9 +25,15 @@ export default function PostActions({ post, isPreview }: Props) { }, ]; - const navigate = useNavigate(); - const vote = () => { } + + + const navigate = useNavigate(); + const { vote } = useVote({ + itemId: post.id, + itemType: Vote_Item_Type[post.__typename!] + }); + return (
diff --git a/src/features/Posts/pages/PostDetailsPage/Components/StoryPageContent/useUpdateStory.tsx b/src/features/Posts/pages/PostDetailsPage/Components/StoryPageContent/useUpdateStory.tsx index 8b8972b..4ee3d82 100644 --- a/src/features/Posts/pages/PostDetailsPage/Components/StoryPageContent/useUpdateStory.tsx +++ b/src/features/Posts/pages/PostDetailsPage/Components/StoryPageContent/useUpdateStory.tsx @@ -21,7 +21,8 @@ export const useUpdateStory = (story: Story) => { deleteStoryId: story.id }, onError: (error) => NotificationsService.error('Unexpected error happened, please try again', { error }), - onCompleted: () => window.location.pathname = '/blog' + onCompleted: () => window.location.pathname = '/blog', + refetchQueries: ['Feed', 'TrendingPosts'] }) const handleEdit = () => {