Skip to content

Commit

Permalink
🐛 Fix style of more-that-balance-amount error
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet committed Sep 11, 2019
1 parent 81ecd36 commit 3eda095
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/utils/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,15 @@ export const validateAmountFormat = ({
export function getAmountFeedbackAndError({
value, fee, account, token,
}) {
const { message, error } = validateAmountFormat({
let { message: feedback } = validateAmountFormat({
value,
token,
locale: i18n.language,
});
let feedback = message;

const getMaxAmount = () => fromRawLsk(Math.max(0, account.balance - fee));
if (!error && parseFloat(getMaxAmount()) < numeral(value).value()) {
if (!feedback && parseFloat(getMaxAmount()) < numeral(value).value()) {
feedback = i18n.t('Provided amount is higher than your current balance.');
}
return { error, feedback };
return { error: !!feedback, feedback };
}

0 comments on commit 3eda095

Please sign in to comment.