diff --git a/src/pages/chat/chat.ts b/src/pages/chat/chat.ts index f9047e3..af79128 100755 --- a/src/pages/chat/chat.ts +++ b/src/pages/chat/chat.ts @@ -260,7 +260,7 @@ class ChatElement extends HTMLElement { } try { - const service = Services.getInstance(); + const service = await Services.getInstance(); const myAddresses = await service.getMemberFromDevice(); if (!myAddresses) throw new Error('No paired member found'); @@ -342,6 +342,10 @@ class ChatElement extends HTMLElement { private async lookForChildren(): Promise { // Filter processes for the children of current process const service = await Services.getInstance(); + if (!this.processId) { + console.error('No process id'); + return null; + } const children: string[] = await service.getChildrenOfProcess(this.processId); const processRoles = this.processRoles; @@ -711,6 +715,9 @@ class ChatElement extends HTMLElement { //Load all processes private async loadAllProcesses() { console.log('🎯 Loading all processes'); + // TODO : uncomment this when we have a way to get the processSet + //const processSet = await this.getProcessesWhereTheCurrentMemberIs(); + const dbRequest = indexedDB.open('4nk'); return new Promise((resolve, reject) => { @@ -763,6 +770,13 @@ class ChatElement extends HTMLElement { const li = document.createElement('li'); li.className = 'group-list-item'; const oneProcess = process.states[0].commited_in; + console.log("Je suis l'id du processus :" ,oneProcess); + + // Ajouter une classe spéciale si le processus est dans notre Set + //if (processSet?.has(oneProcess)) { + // li.classList.add('user-process'); + //} + li.setAttribute('data-process-id', oneProcess); groupList.appendChild(li); @@ -1068,7 +1082,7 @@ class ChatElement extends HTMLElement { } try { - const service = Services.getInstance(); + const service = await Services.getInstance(); const myAddresses = await service.getMemberFromDevice(); if (!myAddresses) throw new Error('No paired member found');