Skip to content

Commit

Permalink
Fix #17948 - Allow editing of NFT sends
Browse files Browse the repository at this point in the history
  • Loading branch information
darkwing committed Mar 6, 2023
1 parent 01abfb3 commit edd9964
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions ui/pages/confirm-transaction/confirm-token-transaction-switch.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
import React from 'react';
import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';
import { Switch, Route } from 'react-router-dom';
import { useDispatch, useSelector } from 'react-redux';
import { Switch, Route, useHistory } from 'react-router-dom';
import {
CONFIRM_APPROVE_PATH,
CONFIRM_SAFE_TRANSFER_FROM_PATH,
CONFIRM_SEND_TOKEN_PATH,
CONFIRM_SET_APPROVAL_FOR_ALL_PATH,
CONFIRM_TRANSACTION_ROUTE,
CONFIRM_TRANSFER_FROM_PATH,
SEND_ROUTE,
} from '../../helpers/constants/routes';
import { transactionFeeSelector } from '../../selectors';
import ConfirmApprove from '../confirm-approve';
import ConfirmSendToken from '../confirm-send-token';
import ConfirmTokenTransactionBase from '../confirm-token-transaction-base';
import ConfirmTransactionSwitch from '../confirm-transaction-switch';
import { editExistingTransaction } from '../../ducks/send';
import { AssetType } from '../../../shared/constants/transaction';
import { clearConfirmTransaction } from '../../ducks/confirm-transaction/confirm-transaction.duck';

import { useAssetDetails } from '../../hooks/useAssetDetails';

export default function ConfirmTokenTransactionSwitch({ transaction }) {
const { txParams: { data, to: tokenAddress, from: userAddress } = {} } =
transaction;

const dispatch = useDispatch();
const history = useHistory();

const {
assetStandard,
assetName,
Expand Down Expand Up @@ -102,6 +109,14 @@ export default function ConfirmTokenTransactionSwitch({ transaction }) {
decimals={decimals}
image={tokenImage}
tokenAddress={tokenAddress}
onEdit={async ({ txData }) => {
const { id } = txData;
await dispatch(
editExistingTransaction(AssetType.NFT, id.toString()),
);
dispatch(clearConfirmTransaction());
history.push(SEND_ROUTE);
}}
toAddress={toAddress}
tokenAmount={tokenAmount}
tokenId={tokenId}
Expand Down

0 comments on commit edd9964

Please sign in to comment.