From a02b738012e0c88aec9c17f061d47a1d80e17f94 Mon Sep 17 00:00:00 2001 From: Atash03 Date: Mon, 23 Jun 2025 13:36:24 +0500 Subject: [PATCH] fix: added view functionality to videos --- components/InfoBlock.tsx | 4 ++-- components/treasury/ReactionsBlock.tsx | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/components/InfoBlock.tsx b/components/InfoBlock.tsx index 65a6bf8..33c16c5 100644 --- a/components/InfoBlock.tsx +++ b/components/InfoBlock.tsx @@ -38,7 +38,7 @@ const InfoBlock = ({ video_id }: IProps) => { const res = await axios.post(`https://turkmentv.gov.tm/v2/api/material/${video_id}/views/increment`); if (res.status === 200) { materialsArray.push(video_id.toString()); - setView(view + 1); + setView(res.data.view); } } localStorage.setItem('MHB_MATERIALS_ID', materialsArray.join(',')); @@ -46,7 +46,7 @@ const InfoBlock = ({ video_id }: IProps) => { const res = await axios.post(`https://turkmentv.gov.tm/v2/api/material/${video_id}/views/increment`); if (res.status === 200) { localStorage.setItem('MHB_MATERIALS_ID', [video_id.toString()].join(',')); - setView(view + 1); + setView(res.data.view); } } diff --git a/components/treasury/ReactionsBlock.tsx b/components/treasury/ReactionsBlock.tsx index 44b65d2..116b85c 100644 --- a/components/treasury/ReactionsBlock.tsx +++ b/components/treasury/ReactionsBlock.tsx @@ -1,8 +1,6 @@ import { Queries } from '@/api/queries'; import { useMutation, useQuery } from '@tanstack/react-query'; -import { data } from 'autoprefixer'; import axios from 'axios'; -import { Loader } from 'lucide-react'; import React from 'react'; import { BiSolidLike, BiLike, BiSolidDislike, BiDislike } from 'react-icons/bi'; import { useLocalStorage } from 'usehooks-ts';