From 46829afa5710283d5d39c58fdfebad6870268eb0 Mon Sep 17 00:00:00 2001 From: Shubhojeet Bera Date: Sun, 23 Jun 2024 20:45:44 +0530 Subject: [PATCH] fix: minor typo bug --- frontend/src/Components/LikeVideos.jsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/frontend/src/Components/LikeVideos.jsx b/frontend/src/Components/LikeVideos.jsx index 3bc0685..c4a5ec6 100644 --- a/frontend/src/Components/LikeVideos.jsx +++ b/frontend/src/Components/LikeVideos.jsx @@ -8,7 +8,7 @@ import Skeleton, { SkeletonTheme } from "react-loading-skeleton"; import "react-loading-skeleton/dist/skeleton.css"; import { useSelector } from "react-redux"; function LikeVideos() { - const backendURL = "https://youtube-clone-mern-backend.vercel.app" + const backendURL = "https://youtube-clone-mern-backend.vercel.app"; // const backendURL = "http://localhost:3000"; const [menuClicked, setMenuClicked] = useState(() => { const menu = localStorage.getItem("menuClicked"); @@ -38,16 +38,18 @@ function LikeVideos() { useEffect(() => { const getLikeVideos = async () => { try { - const response = await fetch( - `${backendURL}/getlikevideos/${user?.email}` - ); - const result = await response.json(); - setLikedVideos(result); + if (user?.email) { + const response = await fetch( + `${backendURL}/getlikevideos/${user?.email}` + ); + const result = await response.json(); + setLikedVideos(result); + } } catch (error) { // console.log(error.message); } }; - return () => getLikeVideos(); + getLikeVideos(); }, [user?.email]); useEffect(() => { @@ -132,7 +134,7 @@ function LikeVideos() { : "liked-video-data light-mode text-light-mode" } > - {videolike.length > 0 ? ( + {videolike?.length > 0 ? (