Skip to content

Commit

Permalink
fix: minor typo bug
Browse files Browse the repository at this point in the history
  • Loading branch information
shubho0908 committed Jun 23, 2024
1 parent b0deb29 commit b828e48
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions frontend/src/Components/Navbar2.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { BiSearch } from "react-icons/bi";
import { useSelector } from "react-redux";

function Navbar2() {
const backendURL = "https://youtube-clone-mern-backend.vercel.app"
const backendURL = "https://youtube-clone-mern-backend.vercel.app";
// const backendURL = "http://localhost:3000";
const [profilePic, setProfilePic] = useState();
const [userVideos, setUserVideos] = useState([]);
Expand Down Expand Up @@ -90,15 +90,19 @@ function Navbar2() {
useEffect(() => {
const getData = async () => {
try {
const response = await fetch(`${backendURL}/getchannel/${user?.email}`);
const { userProfile } = await response.json();
setProfilePic(userProfile);
if (user?.email) {
const response = await fetch(
`${backendURL}/getchannel/${user?.email}`
);
const { userProfile } = await response.json();
setProfilePic(userProfile);
}
} catch (error) {
// console.log(error.message);
}
};

return () => getData();
getData();
}, [user?.email]);

useEffect(() => {
Expand Down

0 comments on commit b828e48

Please sign in to comment.