From b0deb290550c573d0495a83ee199a614aa308dee Mon Sep 17 00:00:00 2001 From: Shubhojeet Bera Date: Sun, 23 Jun 2024 20:50:39 +0530 Subject: [PATCH] fix: minor typo bug --- frontend/src/Components/Subscriptions.jsx | 14 +++++++++----- frontend/src/Components/Trending.jsx | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/frontend/src/Components/Subscriptions.jsx b/frontend/src/Components/Subscriptions.jsx index 444a634..b3f88fe 100644 --- a/frontend/src/Components/Subscriptions.jsx +++ b/frontend/src/Components/Subscriptions.jsx @@ -11,7 +11,7 @@ import "react-loading-skeleton/dist/skeleton.css"; import { useSelector } from "react-redux"; function Subscriptions() { - const backendURL = "https://youtube-clone-mern-backend.vercel.app" + const backendURL = "https://youtube-clone-mern-backend.vercel.app"; // const backendURL = "http://localhost:3000"; const [subscriptions, setSubscriptions] = useState([]); const [subsVideos, setSubsVideos] = useState([]); @@ -41,14 +41,18 @@ function Subscriptions() { useEffect(() => { const getSubscriptions = async () => { try { - const response = await fetch(`${backendURL}/getsubscriptions/${user?.email}`); - const result = await response.json(); - setSubscriptions(result); + if (user?.email) { + const response = await fetch( + `${backendURL}/getsubscriptions/${user?.email}` + ); + const result = await response.json(); + setSubscriptions(result); + } } catch (error) { // console.log(error.message); } }; - return () => getSubscriptions(); + getSubscriptions(); }, [user?.email]); useEffect(() => { diff --git a/frontend/src/Components/Trending.jsx b/frontend/src/Components/Trending.jsx index e9d17d5..b7c4d57 100644 --- a/frontend/src/Components/Trending.jsx +++ b/frontend/src/Components/Trending.jsx @@ -39,7 +39,7 @@ function Trending() { useEffect(() => { setTimeout(() => { setLoading(false); - }, 3200); + }, 1000); }, []); useEffect(() => {