diff --git a/src/components/beneficiarySelectionContent/beneficiarySelectionContent.tsx b/src/components/beneficiarySelectionContent/beneficiarySelectionContent.tsx index 64d4ceb88..a910dd014 100644 --- a/src/components/beneficiarySelectionContent/beneficiarySelectionContent.tsx +++ b/src/components/beneficiarySelectionContent/beneficiarySelectionContent.tsx @@ -22,6 +22,7 @@ interface BeneficiarySelectionContentProps { powerDown?: boolean; powerDownBeneficiaries?: Beneficiary[]; handleSaveBeneficiary?: (beneficiaries: Beneficiary[]) => void; + handleRemoveBeneficiary?: (beneficiary: Beneficiary) => void; } const BeneficiarySelectionContent = ({ @@ -30,6 +31,7 @@ const BeneficiarySelectionContent = ({ powerDown, powerDownBeneficiaries, handleSaveBeneficiary, + handleRemoveBeneficiary, }: BeneficiarySelectionContentProps) => { const intl = useIntl(); const dispatch = useAppDispatch(); @@ -306,8 +308,13 @@ const BeneficiarySelectionContent = ({ const _onRemovePress = () => { beneficiaries[0].weight = beneficiaries[0].weight + item.weight; - beneficiaries.splice(index, 1); + const removedBeneficiary = beneficiaries.splice(index, 1); setBeneficiaries([...beneficiaries]); + console.log('removedBeneficiary : ', removedBeneficiary); + if(handleRemoveBeneficiary){ + handleRemoveBeneficiary(removedBeneficiary[0]); + return; + } _saveBeneficiaries(beneficiaries); }; diff --git a/src/screens/transfer/screen/powerDownScreen.js b/src/screens/transfer/screen/powerDownScreen.js index d8b9ff5d0..67c66f25d 100644 --- a/src/screens/transfer/screen/powerDownScreen.js +++ b/src/screens/transfer/screen/powerDownScreen.js @@ -185,6 +185,17 @@ class PowerDownView extends Component { ); } }; + + const _handleRemoveBeneficiary = (beneficiary) => { + if (beneficiary) { + const beneficiaryAccount = { + username: beneficiary.account, + percent: beneficiary.weight / 100, + autoPowerUp: beneficiary.autoPowerUp, + }; + this._removeDestinationAccount(beneficiaryAccount); + } + }; return ( );