fix: added view functionality to videos
This commit is contained in:
parent
80d73faad4
commit
a02b738012
|
|
@ -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`);
|
const res = await axios.post(`https://turkmentv.gov.tm/v2/api/material/${video_id}/views/increment`);
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
materialsArray.push(video_id.toString());
|
materialsArray.push(video_id.toString());
|
||||||
setView(view + 1);
|
setView(res.data.view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
localStorage.setItem('MHB_MATERIALS_ID', materialsArray.join(','));
|
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`);
|
const res = await axios.post(`https://turkmentv.gov.tm/v2/api/material/${video_id}/views/increment`);
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
localStorage.setItem('MHB_MATERIALS_ID', [video_id.toString()].join(','));
|
localStorage.setItem('MHB_MATERIALS_ID', [video_id.toString()].join(','));
|
||||||
setView(view + 1);
|
setView(res.data.view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
import { Queries } from '@/api/queries';
|
import { Queries } from '@/api/queries';
|
||||||
import { useMutation, useQuery } from '@tanstack/react-query';
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
||||||
import { data } from 'autoprefixer';
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { Loader } from 'lucide-react';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { BiSolidLike, BiLike, BiSolidDislike, BiDislike } from 'react-icons/bi';
|
import { BiSolidLike, BiLike, BiSolidDislike, BiDislike } from 'react-icons/bi';
|
||||||
import { useLocalStorage } from 'usehooks-ts';
|
import { useLocalStorage } from 'usehooks-ts';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue