Feat : fix back button

uat
Quy_FE 3 months ago
parent 4ccc74e332
commit e092dc64b1
  1. 6
      src/_screens/home/detail-room-education/index.js
  2. 8
      src/_screens/home/education-department/index.js

@ -13,10 +13,12 @@ import BoxDoughnutBarChart from "../../../_components/boxChart/BoxDoughnutBarCha
import { apiCaller, history } from "../../../_helpers"; import { apiCaller, history } from "../../../_helpers";
import { replacePathParams } from "../../../_helpers/utils"; import { replacePathParams } from "../../../_helpers/utils";
import $ from "jquery"; import $ from "jquery";
import { useParams } from "react-router-dom"; import { useLocation, useParams } from "react-router-dom";
export default function DetailRoomEducation() { 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 grade = useSelector((state) => state.grade);
const authentication = useSelector((state) => state.authentication); const authentication = useSelector((state) => state.authentication);
const [dateStudentChart, setDateStudentChart] = useState(new Date()) const [dateStudentChart, setDateStudentChart] = useState(new Date())

@ -83,7 +83,13 @@ export default function EducationDepartmentHome() {
} }
const goToDetailRoomEducation = (item) => { 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(() => { useEffect(() => {

Loading…
Cancel
Save