fix: use environment variable for API URL
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import API_URL from "../../config/api";
|
||||
import styles from "./styles.module.css";
|
||||
import { LuUser, LuMenu, LuSearch, LuLogOut, LuUsers, LuMail, LuGraduationCap, LuTvMinimalPlay, LuLayoutDashboard, LuCircleUser, LuPanelLeftClose, LuClock3, LuCalendar } from "react-icons/lu";
|
||||
import { useEffect, useState } from "react";
|
||||
@@ -13,7 +14,8 @@ 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() {
|
||||
const [showMenu, setShowMenu] = useState(false);
|
||||
@@ -28,7 +30,7 @@ export default function Header() {
|
||||
const { getVideos } = useGetVideos();
|
||||
const { getVideosSearch } = useGetVideosSearch();
|
||||
const { getWorkshopsSearch } = useGetWorkshopsSearch();
|
||||
const { getCurrentUser } = useGetCurrentUser();
|
||||
/* const { getCurrentUser } = useGetCurrentUser(); */
|
||||
const [role, setRole] = useState(0);
|
||||
const [videosWatched, setVideosWatched] = useState(0);
|
||||
const [videosCount, setVideosCount] = useState(0);
|
||||
@@ -41,8 +43,8 @@ export default function Header() {
|
||||
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 userData = await getCurrentUser();
|
||||
setRole(userData.data.role_id); */
|
||||
};
|
||||
fetchAll();
|
||||
}, []);
|
||||
@@ -235,7 +237,7 @@ export default function Header() {
|
||||
<div className={`${styles.boxVideo} position-relative`} >
|
||||
<img
|
||||
className={`${styles.videoThumbnail} position-absolute top-0 start-0 bottom-0 h-100`}
|
||||
src={`http://127.0.0.1:8000/storage/${video.thumbnail}`}
|
||||
src={`${API_URL}/storage/${video.thumbnail}`}
|
||||
alt={video.title}
|
||||
style={imageSkeletonFadeStyle}
|
||||
onLoad={onImageSkeletonLoad}
|
||||
@@ -267,7 +269,7 @@ export default function Header() {
|
||||
<Link to={`/workshop/${workshop.id}`} className="text-decoration-none text-black" onClick={handleCloseSearch}>
|
||||
<div className={`${styles.thumbnailWorkshop} position-relative`}>
|
||||
<img
|
||||
src={`http://127.0.0.1:8000/storage/${workshop.image}`}
|
||||
src={`${API_URL}/storage/${workshop.image}`}
|
||||
alt={workshop.title}
|
||||
className={styles.thumbnailWorkshop}
|
||||
style={imageSkeletonFadeStyle}
|
||||
|
||||
Reference in New Issue
Block a user