diff --git a/src/_screens/home/detail-room-education/index.js b/src/_screens/home/detail-room-education/index.js index a02623a..41e6376 100644 --- a/src/_screens/home/detail-room-education/index.js +++ b/src/_screens/home/detail-room-education/index.js @@ -13,10 +13,12 @@ import BoxDoughnutBarChart from "../../../_components/boxChart/BoxDoughnutBarCha import { apiCaller, history } from "../../../_helpers"; import { replacePathParams } from "../../../_helpers/utils"; import $ from "jquery"; -import { useParams } from "react-router-dom"; +import { useLocation, useParams } from "react-router-dom"; export default function DetailRoomEducation() { - const {idRoom,isBack} = useParams() + const {idRoom} = useParams() + const location = useLocation(); + const isBack = location.state?.isBack; const grade = useSelector((state) => state.grade); const authentication = useSelector((state) => state.authentication); const [dateStudentChart, setDateStudentChart] = useState(new Date()) diff --git a/src/_screens/home/education-department/index.js b/src/_screens/home/education-department/index.js index 60cf3a3..b0d262b 100644 --- a/src/_screens/home/education-department/index.js +++ b/src/_screens/home/education-department/index.js @@ -83,7 +83,13 @@ export default function EducationDepartmentHome() { } const goToDetailRoomEducation = (item) => { - history.push(replacePathParams(PATH.home.detailRoomEducation, {idRoom: item?.id, isBack: true})) + const idRoom = item?.id; + const detailPath = replacePathParams(PATH.home.detailRoomEducation, { idRoom }); + + history.push({ + pathname: detailPath, + state: { isBack: true }, + }); } useEffect(() => {