Browse Source

minor code style change

all-modes^2^2
pbca26 8 years ago
parent
commit
bfb0b5dc17
  1. 8
      react/src/components/dashboard/qrModal/qrModal.js
  2. 21
      react/src/components/dashboard/sendCoin/sendCoin.js
  3. 29
      react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js

8
react/src/components/dashboard/qrModal/qrModal.js

@ -33,15 +33,9 @@ class QRModal extends React.Component {
} }
handleError(err) { handleError(err) {
if (err.name === 'NoVideoInputDevicesError') {
this.setState({ this.setState({
error: translate('DASHBOARD.QR_ERR_NO_VIDEO_DEVICE'), error: err.name === 'NoVideoInputDevicesError' ? translate('DASHBOARD.QR_ERR_NO_VIDEO_DEVICE') : translate('DASHBOARD.QR_ERR_UNKNOWN'),
}); });
} else {
this.setState({
error: translate('DASHBOARD.QR_ERR_UNKNOWN'),
});
}
} }
openModal() { openModal() {

21
react/src/components/dashboard/sendCoin/sendCoin.js

@ -68,25 +68,26 @@ class SendCoin extends React.Component {
setRecieverFromScan(receiver) { setRecieverFromScan(receiver) {
try { try {
var o = JSON.parse(receiver); const recObj = JSON.parse(receiver);
if (o && typeof o === "object") {
if(o.coin === this.props.ActiveCoin.coin) { if (recObj &&
if(o.amount) { typeof recObj === 'object') {
if (recObj.coin === this.props.ActiveCoin.coin) {
if (recObj.amount) {
this.setState({ this.setState({
amount: o.amount amount: recObj.amount,
}); });
} }
if(o.address) { if (recObj.address) {
this.setState({ this.setState({
sendTo: o.address sendTo: recObj.address,
}); });
} }
} }
} }
} } catch (e) {
catch (e) {
this.setState({ this.setState({
sendTo: receiver sendTo: receiver,
}); });
} }

29
react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js

@ -82,25 +82,26 @@ class WalletsNativeSend extends React.Component {
setRecieverFromScan(receiver) { setRecieverFromScan(receiver) {
try { try {
var o = JSON.parse(receiver); const recObj = JSON.parse(receiver);
if (o && typeof o === "object") {
if(o.coin === this.props.ActiveCoin.coin) { if (recObj &&
if(o.amount) { typeof recObj === 'object') {
if (recObj.coin === this.props.ActiveCoin.coin) {
if (recObj.amount) {
this.setState({ this.setState({
amount: o.amount amount: recObj.amount,
}); });
} }
if(o.address) { if (recObj.address) {
this.setState({ this.setState({
sendTo: o.address sendTo: recObj.address,
}); });
} }
} }
} }
} } catch (e) {
catch (e) {
this.setState({ this.setState({
sendTo: receiver sendTo: receiver,
}); });
} }
document.getElementById('kmdWalletSendTo').focus(); document.getElementById('kmdWalletSendTo').focus();
@ -117,9 +118,11 @@ class WalletsNativeSend extends React.Component {
} }
checkZAddressCount() { checkZAddressCount() {
if (this.props.ActiveCoin.addresses && const _addresses = this.props.ActiveCoin.addresses;
(!this.props.ActiveCoin.addresses.private ||
this.props.ActiveCoin.addresses.private.length === 0)) { if (_addresses &&
(!_addresses.private ||
_addresses.private.length === 0)) {
this.setState({ this.setState({
renderAddressDropdown: false, renderAddressDropdown: false,
}); });

Loading…
Cancel
Save