Fix unhandled premium input with too many decimal digits

This commit is contained in:
Reckless_Satoshi 2022-07-23 13:54:24 -07:00
parent e0d4b4f7d1
commit 7b75973eba
No known key found for this signature in database
GPG Key ID: 9C4585B561315571

View File

@ -199,6 +199,7 @@ class MakerPage extends Component {
const { t } = this.props;
var max = 999;
var min = -100;
var premium = e.target.value
if(e.target.value > 999){
var bad_premium = t("Must be less than {{max}}%", {max:max})
}
@ -206,8 +207,13 @@ class MakerPage extends Component {
var bad_premium = t("Must be more than {{min}}%", {min:min})
}
if (premium == ""){
premium = 0
} else {
premium = Number(Math.round(premium +"e"+ 2) + "e-" + 2)
}
this.setState({
premium: e.target.value,
premium: premium,
badPremium: bad_premium,
});
}