Skip to content

Commit

Permalink
image navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
TanishqMehrunkarIIPSDAVV committed Oct 26, 2024
1 parent 20065f2 commit 00c82ed
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Navbar/Navbar.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import React, { useState } from "react";
import React, { useEffect, useState } from "react";
import { FaBars, FaTimes } from "react-icons/fa";
import { useNavigate, useLocation } from "react-router-dom";
import { FaPowerOff } from "react-icons/fa";
import "./Navbar.css";
import defaultPhoto from "../Assets/profile_photo.png";
import axios from "axios";
const Navbar = () => {
const [open, setOpen] = useState(false);
const navigate = useNavigate();
const location = useLocation();
const photo = localStorage.getItem("photo") || defaultPhoto;


const [photo,setPhoto] = useState("");
useEffect(()=>
{
axios.post(`${process.env.REACT_APP_BACKEND_URL}/teacher/getteacherDetails`,{teacherId: localStorage.getItem("teacherId")})
.then((res)=>{setPhoto(localStorage.getItem("photo") || res.data.teacher.photo || defaultPhoto)}).catch((err)=>{console.error(err)});
},[]);

const responsive = () => {
const sidebar = document.getElementsByClassName("navbar-sidebar")[0];
Expand All @@ -35,7 +43,7 @@ const Navbar = () => {
<img
alt="Image"
className="pfp"
src={photo}
src={photo || defaultPhoto}
width="35"
height="35"

Expand Down

0 comments on commit 00c82ed

Please sign in to comment.