mirror of https://github.com/embarklabs/embark.git
Feedback PR
This commit is contained in:
parent
c043adf031
commit
ede5afa6e0
|
@ -9,11 +9,6 @@ import LoadMore from '../components/LoadMore';
|
|||
|
||||
class BlocksContainer extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.loadMore = this.loadMore.bind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (!this.props.blocks.data) {
|
||||
this.props.fetchBlocks();
|
||||
|
@ -46,7 +41,7 @@ class BlocksContainer extends Component {
|
|||
return (
|
||||
<React.Fragment>
|
||||
<Blocks blocks={blocks.data}/>
|
||||
{(this.loadMoreFrom() >= 0) ? <LoadMore loadMore={this.loadMore} /> : <React.Fragment />}
|
||||
{(this.loadMoreFrom() >= 0) ? <LoadMore loadMore={() => this.loadMore()} /> : <React.Fragment />}
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import {RECEIVE_BLOCKS, RECEIVE_BLOCKS_ERROR} from "../actions";
|
|||
export default function blocks(state = {}, action) {
|
||||
switch (action.type) {
|
||||
case RECEIVE_BLOCKS:
|
||||
return Object.assign({}, state, {data: [...state.data || [], ...action.blocks.data]});
|
||||
return {...state, data: [...state.data || [], ...action.blocks.data]};
|
||||
case RECEIVE_BLOCKS_ERROR:
|
||||
return Object.assign({}, state, {error: true});
|
||||
default:
|
||||
|
|
|
@ -301,6 +301,7 @@ class BlockchainConnector {
|
|||
function(callback) {
|
||||
self.getTransactionCount(address, (err, count) => {
|
||||
if (err) {
|
||||
self.logger.error(err);
|
||||
result.transactionCount = 0;
|
||||
} else {
|
||||
result.transactionCount = count;
|
||||
|
@ -311,6 +312,7 @@ class BlockchainConnector {
|
|||
function(callback) {
|
||||
self.getBalance(address, (err, balance) => {
|
||||
if (err) {
|
||||
self.logger.error(err);
|
||||
result.balance = 0;
|
||||
} else {
|
||||
result.balance = self.web3.utils.fromWei(balance);
|
||||
|
@ -342,6 +344,7 @@ class BlockchainConnector {
|
|||
}
|
||||
self.getBlockNumber((err, blockNumber) => {
|
||||
if (err) {
|
||||
self.logger.error(err);
|
||||
from = 0;
|
||||
} else {
|
||||
from = blockNumber;
|
||||
|
@ -353,14 +356,13 @@ class BlockchainConnector {
|
|||
async.times(limit, function(n, next) {
|
||||
self.web3.eth.getBlock(from - n, function(err, block) {
|
||||
if (err){
|
||||
self.logger.error(err);
|
||||
return next();
|
||||
}
|
||||
results.push(block);
|
||||
next();
|
||||
});
|
||||
}, function() {
|
||||
callback();
|
||||
});
|
||||
}, callback);
|
||||
}
|
||||
], function () {
|
||||
res.send(results);
|
||||
|
|
Loading…
Reference in New Issue