From 7b75973ebae7b6241c0a53df119fa293271ad2e1 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Sat, 23 Jul 2022 13:54:24 -0700 Subject: [PATCH] Fix unhandled premium input with too many decimal digits --- frontend/src/components/MakerPage.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/MakerPage.js b/frontend/src/components/MakerPage.js index a2bda5d5..ef01c144 100644 --- a/frontend/src/components/MakerPage.js +++ b/frontend/src/components/MakerPage.js @@ -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, }); }