Open spchaplin opened 3 years ago
This is probably too late but I will write if anyone has the same problem. Also should be a good idea to document this at Storybook.
You can do the following:
const handleDelete = (cardId) => {
console.log('here you can do whatever a request for example')
};
const beforeDelete = (handleDelete) => {
const confirmation = confirm('You sure?');
if (confirmation) {
handleDelete();
}
};
<Board
onBeforeCardDelete={(handleDelete) => {
return beforeDelete(handleDelete);
}}
onCardDelete={(cardId) => handleDelete(cardId)}
/>
Is there any chance we could get access to the "cardId" argument in beforeDelete ? This way we can run the request in the beforeDelete function, if the request is successful then we would be able to call handleDelete(), otherwise if an error occurs the card wouldn't be removed from the board
Would someone please provide an example of how to use onBeforeCardDelete?
I'm not finding that it works that same as other event handlers like onCardAdd. The comment by dapi when the feature request was added seems to indicate that a custom card component may be required to use onBeforeCardDelete. Is this correct?
Many thanks!