fix: offcava

This commit is contained in:
Xavier Oliveira
2026-05-28 17:51:13 +01:00
parent 21f7f444dc
commit ca79de6cc1
7 changed files with 66 additions and 68 deletions
@@ -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);