Fix bug where page 0 is falsy and pagination would not be enabled.
This commit is contained in:
parent
4b1b929cff
commit
8a21f48d2a
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var bitcore = require('bitcore');
|
var bitcore = require('bitcore');
|
||||||
|
var _ = bitcore.deps._;
|
||||||
var common = require('./common');
|
var common = require('./common');
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
|
|
||||||
@ -31,7 +32,7 @@ TxController.prototype.transaction = function(req, res, next, txid) {
|
|||||||
if(err) {
|
if(err) {
|
||||||
return res.send({
|
return res.send({
|
||||||
error: err.toString()
|
error: err.toString()
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
req.transaction = self.transformTransaction(transaction);
|
req.transaction = self.transformTransaction(transaction);
|
||||||
@ -206,7 +207,7 @@ TxController.prototype.list = function(req, res) {
|
|||||||
var txs = block.transactions;
|
var txs = block.transactions;
|
||||||
var totalTxs = txs.length;
|
var totalTxs = txs.length;
|
||||||
|
|
||||||
if(page) {
|
if(!_.isUndefined(page)) {
|
||||||
txs = txs.splice(page * pageLength, pageLength);
|
txs = txs.splice(page * pageLength, pageLength);
|
||||||
pagesTotal = Math.ceil(totalTxs / pageLength);
|
pagesTotal = Math.ceil(totalTxs / pageLength);
|
||||||
}
|
}
|
||||||
@ -275,4 +276,4 @@ TxController.prototype.send = function(req, res) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = TxController;
|
module.exports = TxController;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user