Fix redirection

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2020-07-03 10:45:49 +02:00 committed by Alexandre Bodin
parent df3346fb39
commit 0fd8100a47

View File

@ -1,5 +1,4 @@
import React, { memo, useCallback } from 'react'; import React, { memo, useCallback } from 'react';
import { withRouter } from 'react-router';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { get, isEmpty, isNull, isObject, toLower, toString } from 'lodash'; import { get, isEmpty, isNull, isObject, toLower, toString } from 'lodash';
import moment from 'moment'; import moment from 'moment';
@ -68,7 +67,7 @@ const getDisplayedValue = (type, value, name) => {
} }
}; };
function Row({ canDelete, canUpdate, goTo, isBulkable, row, headers }) { function Row({ canDelete, canUpdate, isBulkable, row, headers }) {
const { entriesToDelete, onChangeBulk, onClickDelete, schema } = useListView(); const { entriesToDelete, onChangeBulk, onClickDelete, schema } = useListView();
const memoizedDisplayedValue = useCallback( const memoizedDisplayedValue = useCallback(
@ -85,10 +84,6 @@ function Row({ canDelete, canUpdate, goTo, isBulkable, row, headers }) {
const links = [ const links = [
{ {
icon: canUpdate ? <FontAwesomeIcon icon="pencil-alt" /> : null, icon: canUpdate ? <FontAwesomeIcon icon="pencil-alt" /> : null,
onClick: () => {
emitEvent('willEditEntryFromList');
goTo(row.id);
},
}, },
{ {
icon: canDelete ? <FontAwesomeIcon icon="trash-alt" /> : null, icon: canDelete ? <FontAwesomeIcon icon="trash-alt" /> : null,
@ -134,10 +129,9 @@ function Row({ canDelete, canUpdate, goTo, isBulkable, row, headers }) {
Row.propTypes = { Row.propTypes = {
canDelete: PropTypes.bool.isRequired, canDelete: PropTypes.bool.isRequired,
canUpdate: PropTypes.bool.isRequired, canUpdate: PropTypes.bool.isRequired,
goTo: PropTypes.func.isRequired,
headers: PropTypes.array.isRequired, headers: PropTypes.array.isRequired,
isBulkable: PropTypes.bool.isRequired, isBulkable: PropTypes.bool.isRequired,
row: PropTypes.object.isRequired, row: PropTypes.object.isRequired,
}; };
export default withRouter(memo(Row)); export default memo(Row);