lbry-desktop/ui/modal/modalRemoveFile/index.js
jessopb 4f6befc0ce
Fix doAbandonClaim (#699) (#7422)
* Refactor doAbandonClaim parameters to only claim

- Gets txid and nout by default now, and passing claim allows using more data to verify ownership in case of txid:nout failing again
- Unused on modalRemoveCard
- Edited the comment on doCollectionDelete to explain better

* Fix doAbandonClaim failing to select my claim

Co-authored-by: saltrafael <76502841+saltrafael@users.noreply.github.com>
2022-01-19 20:54:01 -05:00

28 lines
1 KiB
JavaScript

import { connect } from 'react-redux';
import { doDeleteFileAndMaybeGoBack } from 'redux/actions/file';
import {
selectTitleForUri,
selectClaimForUri,
makeSelectIsAbandoningClaimForUri,
selectClaimIsMineForUri,
} from 'redux/selectors/claims';
import { doResolveUri } from 'redux/actions/claims';
import { doHideModal } from 'redux/actions/app';
import ModalRemoveFile from './view';
const select = (state, props) => ({
claimIsMine: selectClaimIsMineForUri(state, props.uri),
title: selectTitleForUri(state, props.uri),
claim: selectClaimForUri(state, props.uri),
isAbandoning: makeSelectIsAbandoningClaimForUri(props.uri)(state),
});
const perform = (dispatch) => ({
closeModal: () => dispatch(doHideModal()),
doResolveUri: (uri) => dispatch(doResolveUri(uri)),
deleteFile: (uri, deleteFromComputer, abandonClaim, doGoBack, claim) => {
dispatch(doDeleteFileAndMaybeGoBack(uri, deleteFromComputer, abandonClaim, doGoBack, claim));
},
});
export default connect(select, perform)(ModalRemoveFile);