export default()

in src/frontend/src/components/DeleteMediaContent.js [6:32]


export default ({ onConfirm, onDeleted, onError }) => {
  const [confirmationShown, showConfirmation] = useState(false);
  const [deleting, setDeleting] = useState(false);

  const hideModal = () => showConfirmation(false);
  const deleteMediaItem = () => {
    setDeleting(true);

    const afterDeletion = () => {
      hideModal();
      setDeleting(false);
      onDeleted();
    };

    const withError = () => {
      afterDeletion();
      onError();
    };

    return onConfirm()
      .then(afterDeletion)
      .catch(withError);
  };

  return (
    <>
      <Button size="sm" variant="danger" onClick={() => showConfirmation(true)}>