diff --git a/src/pages/account/account.ts b/src/pages/account/account.ts index 143a468..3e05daa 100755 --- a/src/pages/account/account.ts +++ b/src/pages/account/account.ts @@ -855,23 +855,38 @@ private async showProcess(): Promise { if (container) { const service = await Services.getInstance(); const myProcesses = await service.getMyProcesses(); - let myProcessesData = await Promise.all(myProcesses.map(async processId => { - const process = await service.getProcess(processId); - const lastState = service.getLastCommitedState(process); - if (!lastState) { - return null; - } - const description = await service.decryptAttribute(processId, lastState, 'description'); - const name = description ? description : 'N/A'; - const publicData = await service.getPublicData(process); - console.log(publicData); - return { - name: name, - publicData: publicData - }; - })); - myProcessesData = myProcessesData.filter(process => process !== null); - createProcessTab(container, myProcessesData); + if (myProcesses && myProcesses.length != 0) { + const myProcessesDataUnfiltered: { name: string, publicData: Record }[] = await Promise.all(myProcesses.map(async processId => { + const process = await service.getProcess(processId); + const lastState = service.getLastCommitedState(process); + if (!lastState) { + return { + name: '', + publicData: {} + }; + } + const description = await service.decryptAttribute(processId, lastState, 'description'); + const name = description ? description : 'N/A'; + const publicData = await service.getPublicData(process); + if (!publicData) { + return { + name: '', + publicData: {} + }; + } + return { + name: name, + publicData: publicData + }; + })); + const myProcessesData = myProcessesDataUnfiltered.filter( + (p) => p.name !== '' && Object.keys(p.publicData).length != 0 + ); + + createProcessTab(container, myProcessesData); + } else { + createProcessTab(container, []); + } } }