Skip to content

Commit

Permalink
Merge pull request #2215 from Chia-Network/paninaro.fix_double_confirm
Browse files Browse the repository at this point in the history
Remove a redundant confirmation when deleting an offer notification
  • Loading branch information
seeden authored Oct 27, 2023
2 parents ad843df + e311367 commit ed9b212
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions packages/gui/src/components/offers2/OfferIncomingTable.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
import { toBech32m } from '@chia-network/api';
import {
Card,
Flex,
Table,
LoadingOverlay,
Button,
useShowError,
Tooltip,
useCurrencyCode,
useOpenDialog,
ConfirmDialog,
} from '@chia-network/core';
import { Card, Flex, Table, LoadingOverlay, Button, useShowError, Tooltip, useCurrencyCode } from '@chia-network/core';
import { Offers as OffersIcon } from '@chia-network/icons';
import { Trans } from '@lingui/macro';
import { Typography } from '@mui/material';
Expand Down Expand Up @@ -133,7 +122,6 @@ export default function OfferIncomingTable(props: OfferIncomingTableProps) {
const { notifications = [], isLoading, deleteNotification } = useValidNotifications();
const navigate = useNavigate();
const location = useLocation();
const openDialog = useOpenDialog();
const currencyCode = useCurrencyCode();
const showError = useShowError();
const { getOffer } = useOffers();
Expand Down Expand Up @@ -211,17 +199,7 @@ export default function OfferIncomingTable(props: OfferIncomingTableProps) {

async function handleDeleteNotification(notification: Notification) {
try {
const canProcess = await openDialog(
<ConfirmDialog title={<Trans>Confirmation</Trans>} confirmTitle={<Trans>Yes</Trans>} confirmColor="primary">
<Trans>
Are you sure you'd like to remove this offer? Please remember that this action is not reversible.
</Trans>
</ConfirmDialog>
);

if (canProcess) {
await deleteNotification(notification.id);
}
await deleteNotification(notification.id);
} catch (e) {
showError(e);
}
Expand Down

0 comments on commit ed9b212

Please sign in to comment.