Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Fix blocks api return null total instead of 0
Browse files Browse the repository at this point in the history
  • Loading branch information
priojeetpriyom committed Oct 31, 2023
1 parent 7a3671e commit 44b0267
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion services/blockchain-indexer/shared/dataService/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const getBlocksTotal = async (params, blocksResponse) => {
let total;

if (params.generatorAddress) {
total = blocksResponse.meta.total || null;
total = typeof blocksResponse.meta.total === 'undefined' ? null : blocksResponse.meta.total;
} else if (params.blockID || !Number.isNaN(Number(params.height))) {
total = blocksResponse.data.length;
} else if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ const getBlocks = async params => {
const blocksTable = await getBlocksTable();
const blocks = {
data: [],
meta: {},
meta: {
count: 0,
offset: params.offset,
total: 0,
},
};

if (params.blockID) {
Expand Down

0 comments on commit 44b0267

Please sign in to comment.