Bug fix
This commit is contained in:
parent
55d4b17cdc
commit
abb37627a8
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>RanchiMall exchange</title>
|
<title>RanchiMall Exchange</title>
|
||||||
<meta name="description" content="Trade FLO and FLO based RanchiMall tokens.">
|
<meta name="description" content="Trade FLO and FLO based RanchiMall tokens.">
|
||||||
<meta name="theme-color" content="#516beb" />
|
<meta name="theme-color" content="#516beb" />
|
||||||
<script src="scripts/components.js" defer></script>
|
<script src="scripts/components.js" defer></script>
|
||||||
@ -1821,9 +1821,14 @@
|
|||||||
|
|
||||||
// remove digitals after specified decimal places without rounding
|
// remove digitals after specified decimal places without rounding
|
||||||
function toFixed(num, fixed = 8) {
|
function toFixed(num, fixed = 8) {
|
||||||
var re = new RegExp('^-?\\d+(?:\.\\d{0,' + (fixed || -1) + '})?');
|
const re = new RegExp(`^-?\\d+(?:\\.\\d{0,${fixed}})?`);
|
||||||
return parseFloat(num.toString().match(re)[0]);
|
const match = num.toString().match(re);
|
||||||
|
if (!match) {
|
||||||
|
return NaN;
|
||||||
}
|
}
|
||||||
|
return parseFloat(match[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getSuggestedPrice(asset = pagesData.params.asset || 'FLO') {
|
function getSuggestedPrice(asset = pagesData.params.asset || 'FLO') {
|
||||||
return toFixed(parseFloat(floGlobals.exchangeRates[asset]) * deviation[tradeType])
|
return toFixed(parseFloat(floGlobals.exchangeRates[asset]) * deviation[tradeType])
|
||||||
@ -2766,6 +2771,7 @@
|
|||||||
showSuggestedPrice()
|
showSuggestedPrice()
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
notify(error.message, 'error');
|
notify(error.message, 'error');
|
||||||
|
reject(error)
|
||||||
})
|
})
|
||||||
}).catch(error => console.error(error))
|
}).catch(error => console.error(error))
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user