Browse Source

render local utxo data(wip)

all-modes
pbca26 8 years ago
parent
commit
04af9b1655
  1. 12
      react/src/actions/actionCreators.js
  2. 11
      react/src/components/dashboard/sendCoin.js
  3. 7
      react/src/util/time.js

12
react/src/actions/actionCreators.js

@ -2351,8 +2351,16 @@ export function dexSendRawTX(data) {
console.log(error);
dispatch(triggerToaster(true, 'dexSendRawTX', 'Error', 'error'));
})
.then(response => response.json())
.then(json => resolve(json))
.then(function(response) {
const _response = response.text().then(function(text) { return text; });
return _response;
})
.then(function(json) {
resolve(json);
})
//.then(response => response.json())
//.then(json => resolve(json))
});
}

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

@ -201,14 +201,13 @@ class SendCoin extends React.Component {
dexSendRawTX(dexrawtxData)
.then(function(dexRawTxJson) {
console.log('dexRawTxJson', dexRawTxJson);
if (dexRawTxJson.error === undefined) {
Store.dispatch(sendToAddressStateAlt(dexRawTxJson));
Store.dispatch(triggerToaster(true, translate('TOASTR.SIGNED_TX_SENT'), translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
console.log('utxo remove', true);
if (dexRawTxJson.indexOf('"error":{"code"') > -1) {
Store.dispatch(triggerToaster(true, 'Transaction failed', translate('TOASTR.WALLET_NOTIFICATION'), 'error'));
Store.dispatch(sendToAddressStateAlt(JSON.parse(dexRawTxJson)));
} else {
console.log('utxo alt');
Store.dispatch(triggerToaster(true, translate('TOASTR.SIGNED_TX_SENT'), translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
Store.dispatch(sendToAddressStateAlt(dexRawTxJson));
Store.dispatch(sendToAddressStateAlt(json));
console.log('utxo remove', true);
}
});
} else {

7
react/src/util/time.js

@ -23,4 +23,11 @@ export function secondsToString(seconds, skipMultiply) {
time = date + ' ' + month + ' ' + year + ' ' + hour + ':' + min; // + ':' + sec;
return time;
}
export function checkTimestamp(dateToCheck) {
var currentEpochTime = new Date(Date.now()) / 1000,
secondsElapsed = Number(currentEpochTime) - Number(dateToCheck / 1000);
return Math.floor(secondsElapsed);
}
Loading…
Cancel
Save