Browse Source

minor code style change

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

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

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

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

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

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

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

Loading…
Cancel
Save