Bug fix in routing service

This commit is contained in:
Sosthene 2024-10-12 23:14:19 +02:00
parent 22ff8a7880
commit 0918185ad9

View File

@ -44,12 +44,14 @@ export default class Routing {
document.head.appendChild(newScript).parentNode?.removeChild(newScript); document.head.appendChild(newScript).parentNode?.removeChild(newScript);
} }
public openConfirmationModal(prd?: any, outpointCommitment?: string) { public openConfirmationModal(pcd: any, outpointCommitment: string) {
this.currentPrd = prd; let roles = JSON.parse(pcd['roles']);// ['members'][0];
const sender = JSON.parse(prd.sender)?.sp_addresses console.log(roles);
let html = confirmationModalHtml let members = roles['owner']['members'];
html = html.replace('{{device1}}', sender[0]) console.log(members);
html = html.replace('{{device2}}', sender[1]) let html = confirmationModalHtml;
html = html.replace('{{device1}}', members[0]['sp_addresses'][0]);
html = html.replace('{{device2}}', members[0]['sp_addresses'][1]);
this.currentOutpoint = outpointCommitment as string; this.currentOutpoint = outpointCommitment as string;
const container = document.querySelector('.page-container'); const container = document.querySelector('.page-container');
@ -67,7 +69,7 @@ export default class Routing {
window.onclick = (event) => { window.onclick = (event) => {
const modal = document.getElementById('modal'); const modal = document.getElementById('modal');
if (event.target === modal) { if (event.target === modal) {
this.confirm(this.currentPrd || prd, outpointCommitment || this.currentOutpoint); this.confirm(this.currentPrd || pcd, outpointCommitment || this.currentOutpoint);
} }
} }
} }