Skip to content

Commit

Permalink
feat(neuron-ui): show local error message ahead of remote error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY committed Nov 11, 2019
1 parent 7bf6dbc commit 21fd5b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/neuron-ui/src/components/Send/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const useOnTransactionChange = (
})
}
}, 300)
}, [walletID, items, price, dispatch, setTotalAmount])
}, [walletID, items, price, dispatch, setTotalAmount, setErrorMessage])
}

const useOnSubmit = (items: TransactionOutput[], dispatch: StateDispatch) =>
Expand Down
7 changes: 3 additions & 4 deletions packages/neuron-ui/src/components/Send/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ const Send = ({
const leftStackWidth = '70%'
const labelWidth = '140px'

let errorMessageUnderTotal = errorMessage
if (!errorMessageUnderTotal && !verifyTotalAmount(totalAmount, fee, balance)) {
errorMessageUnderTotal = t(`messages.codes.${ErrorCode.AmountNotEnough}`)
}
const errorMessageUnderTotal = verifyTotalAmount(totalAmount, fee, balance)
? errorMessage
: t(`messages.codes.${ErrorCode.AmountNotEnough}`)

return (
<Stack verticalFill tokens={{ childrenGap: 15, padding: '20px 0 0 0' }}>
Expand Down

0 comments on commit 21fd5b1

Please sign in to comment.