Skip to content

Commit 15b910a

Browse files
authored
Fix for amount not being set correctly when using fiat value (#600)
1 parent 2d16a8b commit 15b910a

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

react/lib/components/PayButton/PayButton.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -367,17 +367,15 @@ export const PayButton = ({
367367

368368
useEffect(() => {
369369
if (currencyObj && isFiat(currency) && price) {
370-
if (!convertedCurrencyObj) {
371-
const addressType: Currency = getCurrencyTypeFromAddress(to);
372-
const convertedObj = getCurrencyObject(
373-
currencyObj.float / price,
374-
addressType,
375-
randomSatoshis,
376-
);
377-
setCryptoAmount(convertedObj.string);
378-
setConvertedCurrencyObj(convertedObj);
379-
}
380-
} else if (!isFiat(currency) && randomSatoshis && !convertedCurrencyObj) {
370+
const addressType: Currency = getCurrencyTypeFromAddress(to);
371+
const convertedObj = getCurrencyObject(
372+
currencyObj.float / price,
373+
addressType,
374+
randomSatoshis,
375+
);
376+
setCryptoAmount(convertedObj.string);
377+
setConvertedCurrencyObj(convertedObj);
378+
} else if (!isFiat(currency) && randomSatoshis) {
381379
const convertedObj = getCurrencyObject(
382380
amount as number,
383381
addressType,

0 commit comments

Comments
 (0)