Skip to content

Commit

Permalink
fix: Dont create money when amount is empty in quick exchange
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriFA committed Jan 17, 2023
1 parent eb1fc25 commit 220fc59
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions web/src/containers/QuickExchange/QuickExchange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,20 @@ export const QuickExchangeContainer: React.FC = () => {
};

const handleRefresh = () => {
if (!createMoney(requestVolume, DEFAULT_CURRENCY).isZero()) {
dispatch(
marketPriceFetch({
from_currency: fromCurrency,
to_currency: toCurrency,
request_volume: parseNumeric(requestVolume, { trimRightDot: true }),
request_currency: requestCurrency,
}),
);
const noAmount = requestVolume ? createMoney(requestVolume, DEFAULT_CURRENCY).isZero() : true;

if (noAmount) {
return;
}

dispatch(
marketPriceFetch({
from_currency: fromCurrency,
to_currency: toCurrency,
request_volume: parseNumeric(requestVolume, { trimRightDot: true }),
request_currency: requestCurrency,
}),
);
};

const handleExchange = () => {
Expand Down

0 comments on commit 220fc59

Please sign in to comment.