Skip to content

Commit

Permalink
fix :: 층 조회 오류#3
Browse files Browse the repository at this point in the history
  • Loading branch information
tjduddn8511 committed Jun 20, 2024
1 parent 43fba39 commit 6ab4b18
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 30 deletions.
7 changes: 5 additions & 2 deletions src/components/home/class/ClassOne.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Modal from "src/components/modal/classmodal";
import LabD from "src/assets/imgs/LabD.svg";

const ClassOne = () => {
const { floorData, handleRoomName, className, code } = useCheckClass();
const { floorData, handleRoomName, handleSetCode, className, code } = useCheckClass();
const [isClick, setIsClick] = useState(false);

const ModalButton = () => {
Expand All @@ -22,7 +22,10 @@ const ClassOne = () => {
<S.ViewInfomationWrap>
<S.SelectClassImgWrap style={{ position: "relative" }}>
{floorData.map((item, idx) => (
<S.SelectClassImg style={{ position: "relative" }} onClick={() => handleRoomName(item.roomName)}>
<S.SelectClassImg style={{ position: "relative" }} onClick={() => {
handleRoomName(item.roomName)
handleSetCode(item.code)
}}>
<img src={LabD} key={idx} onClick={ModalButton} />
<span style={{ position: "absolute", color: "white" }}>{item.roomName}</span>
</S.SelectClassImg>
Expand Down
3 changes: 1 addition & 2 deletions src/components/home/class/ClassThree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import Modal from "src/components/modal/classmodal";
import LabD from "src/assets/imgs/LabD.svg";

const ClassThree = () => {
const { isClickCls, handleClickMenu, classList, handleClickCls, imgData, classStuList, floorData, className, code } =
useCheckClass();
const { floorData, className, code } = useCheckClass();
const [isClick, setIsClick] = useState(false);

const ModalButton = () => {
Expand Down
32 changes: 9 additions & 23 deletions src/components/home/class/classTwo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,28 @@ import Modal from "src/components/modal/classmodal";
import LabD from "src/assets/imgs/LabD.svg";

const ClassTwo = () => {
const {
isClickCls,
handleClickMenu,
classList,
handleClickCls,
imgData,
code,
classStuList,
floorData,
className,
handleSetCode,
handleRoomName,
loadFloorData,

} = useCheckClass();
const { code, floorData, className, handleSetCode, handleRoomName } = useCheckClass();
const [isClick, setIsClick] = useState(false);

const ModalButton = () => {
setIsClick((prev) => !prev);
};

floorData.map((item) => {
console.log(item.roomName);
});

return (
<S.CheckClassWrap>
<ClassSideBar />
<S.CheckClassMain>
<S.ViewInfomationWrap>
<S.SelectClassImgWrap style={{ position: "relative" }}>
{floorData.map((item, idx) => (
<S.SelectClassImg key={idx} style={{ display: "flex" }} onClick={() => {
handleSetCode(item.code)
handleRoomName(item.roomName)
}}>
<S.SelectClassImg
key={idx}
style={{ display: "flex" }}
onClick={() => {
handleSetCode(item.code);
handleRoomName(item.roomName);
}}
>
<img src={LabD} onClick={ModalButton} />
<span style={{ position: "absolute", color: "white" }}>{item.roomName}</span>
</S.SelectClassImg>
Expand Down
7 changes: 5 additions & 2 deletions src/hooks/home/class/useCheckClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ const useCheckClass = () => {
}, [className]);

// useEffect(() => {
// // checkClassStu() : null;
// checkClassStu() : null;
// }, [code]);

useEffect(() => {
loadFloorData();
if (isClickCategory.includes("층")) {
console.log(isClickCategory);
loadFloorData();
}
}, [isClickCategory]);

const checkClass = async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/home/student/useCheckStudent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const useCheckStudent = () => {
})
.then((res) => {
setStudentClassList(res.data);
console.log(studentClassList);
console.log("앙 존나 기모찌 에러", studentClassList);
});
} catch (error) {
errorToast("학생 조회 실패");
Expand Down

0 comments on commit 6ab4b18

Please sign in to comment.