Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yitong241 committed Apr 15, 2024
1 parent 77c6c82 commit c6414ce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
13 changes: 7 additions & 6 deletions src/containers/Manager/StudentList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ const StudentList: React.FC = () => {
const [modalVisible, setModalVisible] = useState<boolean>(false);
const [inputValue, setInputValue] = useState<string>('');

const getStudentData = async () => {
const res: { user: Student[] } = await getStudents().unwrap();
setStudents(res.user);
};

useEffect(() => {
const getStudentData = async () => {
const res: { user: Student[] } = await getStudents().unwrap();
setStudents(res.user);
};

getStudentData();
}, []);
}, [getStudents]);


const handleCheckboxChange = (studentId: number, checked: boolean) => {
setSelectedIds((prevIds) => {
Expand Down
14 changes: 7 additions & 7 deletions src/containers/Manager/TutorList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ const TutorList: React.FC = () => {
const [demoteTutors] = useDemoteTutorsMutation();
const [tutors, setTutors] = useState<Student[]>([]);
const [selectedIds, setSelectedIds] = useState<number[]>([]);

const getTutorData = async () => {
const res: { user: Tutor[] } = await getTutors().unwrap();
setTutors(res.user);
};


useEffect(() => {
const getTutorData = async () => {
const res: { user: Tutor[] } = await getTutors().unwrap();
setTutors(res.user);
};

getTutorData();
}, []);
}, [getTutors]);

const handleCheckboxChange = (tutorId: number, checked: boolean) => {
setSelectedIds((prevIds) => {
Expand Down

0 comments on commit c6414ce

Please sign in to comment.