Fix bug where page 0 is falsy and pagination would not be enabled.

This commit is contained in:
Braydon Fuller 2015-09-21 14:13:48 -04:00
parent 4b1b929cff
commit 8a21f48d2a

View File

@ -1,6 +1,7 @@
'use strict';
var bitcore = require('bitcore');
var _ = bitcore.deps._;
var common = require('./common');
var async = require('async');
@ -31,7 +32,7 @@ TxController.prototype.transaction = function(req, res, next, txid) {
if(err) {
return res.send({
error: err.toString()
})
});
}
req.transaction = self.transformTransaction(transaction);
@ -206,7 +207,7 @@ TxController.prototype.list = function(req, res) {
var txs = block.transactions;
var totalTxs = txs.length;
if(page) {
if(!_.isUndefined(page)) {
txs = txs.splice(page * pageLength, pageLength);
pagesTotal = Math.ceil(totalTxs / pageLength);
}
@ -275,4 +276,4 @@ TxController.prototype.send = function(req, res) {
});
};
module.exports = TxController;
module.exports = TxController;