fix: offcava
This commit is contained in:
@@ -14,7 +14,7 @@ import { PiCheckCircleFill } from "react-icons/pi";
|
||||
import { useGetWorkshopsSearch } from "../../hooks/useGetWorkshopsSearch";
|
||||
import { imageSkeletonFadeStyle, onImageSkeletonLoad } from "../../utils/imageSkeleton";
|
||||
import { motion, AnimatePresence } from "framer-motion";
|
||||
/* import { useGetCurrentUser } from "../../hooks/useGetCurrentUser"; */
|
||||
import { useGetCurrentUser } from "../../hooks/useGetCurrentUser";
|
||||
|
||||
|
||||
export default function Header() {
|
||||
@@ -30,23 +30,21 @@ export default function Header() {
|
||||
const { getVideos } = useGetVideos();
|
||||
const { getVideosSearch } = useGetVideosSearch();
|
||||
const { getWorkshopsSearch } = useGetWorkshopsSearch();
|
||||
/* const { getCurrentUser } = useGetCurrentUser(); */
|
||||
const [role, _setRole] = useState(0);
|
||||
const { getCurrentUser } = useGetCurrentUser();
|
||||
const [videosWatched, setVideosWatched] = useState(0);
|
||||
const [videosCount, setVideosCount] = useState(0);
|
||||
const [role, setRole] = useState(0);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const fetchAll = async () => {
|
||||
const videosWatched = localStorage.getItem("videosWatched");
|
||||
setVideosWatched(videosWatched ? parseInt(videosWatched) : 0);
|
||||
const videosCount = localStorage.getItem("videosCount");
|
||||
setVideosCount(videosCount ? parseInt(videosCount) : 0);
|
||||
/* const userData = await getCurrentUser();
|
||||
setRole(userData.data.role_id); */
|
||||
const fetchCurrentUser = async () => {
|
||||
const currentUser = await getCurrentUser();
|
||||
setRole(currentUser.data.role_id);
|
||||
setVideosWatched(currentUser.data.videosWatched);
|
||||
setVideosCount(currentUser.data.videosCount);
|
||||
};
|
||||
fetchAll();
|
||||
fetchCurrentUser();
|
||||
}, []);
|
||||
|
||||
const handleCloseMenu = () => setShowMenu(false);
|
||||
|
||||
Reference in New Issue
Block a user