Skip to content

Commit 0595b6c

Browse files
committed
add removeFromCollection action
1 parent 7b629fd commit 0595b6c

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

Diff for: client/modules/User/components/CollectionItemRow.jsx

+7-11
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@ import PropTypes from 'prop-types';
22
import React from 'react';
33
import { Link } from 'react-router-dom';
44
import { useTranslation } from 'react-i18next';
5+
import { useDispatch } from 'react-redux';
6+
import { removeFromCollection } from '../../IDE/actions/collections';
57
import dates from '../../../utils/formatDate';
68
import RemoveIcon from '../../../images/close.svg';
79

8-
const CollectionItemRow = ({
9-
collection,
10-
item,
11-
isOwner,
12-
removeFromCollection
13-
}) => {
10+
const CollectionItemRow = ({ collection, item, isOwner }) => {
1411
const { t } = useTranslation();
12+
const dispatch = useDispatch();
1513
const projectIsDeleted = item.isDeleted;
16-
1714
const handleSketchRemove = () => {
1815
const name = projectIsDeleted ? 'deleted sketch' : item.project.name;
1916

@@ -22,7 +19,7 @@ const CollectionItemRow = ({
2219
t('Collection.DeleteFromCollection', { name_sketch: name })
2320
)
2421
) {
25-
removeFromCollection(collection.id, item.projectId);
22+
dispatch(removeFromCollection(collection.id, item.projectId));
2623
}
2724
};
2825

@@ -75,10 +72,9 @@ CollectionItemRow.propTypes = {
7572
user: PropTypes.shape({
7673
username: PropTypes.string.isRequired
7774
})
78-
}).isRequired
75+
})
7976
}).isRequired,
80-
isOwner: PropTypes.bool.isRequired,
81-
removeFromCollection: PropTypes.func.isRequired
77+
isOwner: PropTypes.bool.isRequired
8278
};
8379

8480
export default CollectionItemRow;

0 commit comments

Comments
 (0)