Skip to content

Commit

Permalink
fix: select all checked
Browse files Browse the repository at this point in the history
  • Loading branch information
sltsheryl committed Jan 12, 2024
1 parent d8ac0ab commit e5a5d47
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pages/view-cart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const ViewCart = ({ courses }) => {
setCartCourses(coursesObjWithPrice);
}, [courses]);
const [checkedItems, setCheckedItems] = useState([]);
const allChecked = useMemo(() => (checkedItems.length > 0 ? checkedItems.every(Boolean) : false), [checkedItems]);
const allChecked = useMemo(() => checkedItems.length === cartCourses.length && checkedItems.every(Boolean), [checkedItems, cartCourses]);
const handleRemove = async index => {
await axios.delete(`/api/cart/${cartCourses[index].id}`, {
data: {
Expand Down

0 comments on commit e5a5d47

Please sign in to comment.