diff --git a/src/services/dataService.js b/src/services/dataService.js index 0ca0739..1633349 100644 --- a/src/services/dataService.js +++ b/src/services/dataService.js @@ -44,12 +44,20 @@ export class DataService { debugInfo = async () => { const debug = this.getCodexDebug(); - return await debug.info(); + const res = await debug.info(); + if (res.error) { + throw new Error(res.data); + } + return res.data; }; localData = async () => { const data = this.getCodexData(); - return await data.cids(); + const res = await data.cids(); + if (res.error) { + throw new Error(res.data); + } + return res.data; }; getCodex = () => { diff --git a/src/ui/dataMenu.js b/src/ui/dataMenu.js index be871e5..679f5db 100644 --- a/src/ui/dataMenu.js +++ b/src/ui/dataMenu.js @@ -54,13 +54,13 @@ export class DataMenu { filesData.content.forEach((file, index) => { const { cid, manifest } = file; const { - originalBytes, + datasetSize, protected: isProtected, filename, mimetype, } = manifest; - const fileSize = (originalBytes / 1024).toFixed(2); + const fileSize = (datasetSize / 1024).toFixed(2); this.ui.showInfoMessage( `${chalk.cyan("File")} ${index + 1} of ${filesData.content.length}\n\n` + diff --git a/src/ui/nodeStatusMenu.js b/src/ui/nodeStatusMenu.js index 556b586..ea97f11 100644 --- a/src/ui/nodeStatusMenu.js +++ b/src/ui/nodeStatusMenu.js @@ -11,18 +11,18 @@ export class NodeStatusMenu { showNodeStatus = async () => { this.debugInfo = await this.fetchDebugInfo(); - if (debugInfo == undefined) return; + if (this.debugInfo == undefined) return; const peerCount = this.debugInfo.table.nodes.length; const isOnline = peerCount > 2; if (isOnline) { - this.showSuccessMessage( + this.ui.showSuccessMessage( "Node is ONLINE & DISCOVERABLE", "🔌 Node Status", ); } else { - this.showInfoMessage( + this.ui.showInfoMessage( "Node is ONLINE but has few peers", "🔌 Node Status", );