Skip to content

Commit 38349ac

Browse files
committed
Adding self revoke
1 parent 297d0b4 commit 38349ac

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

dr-lib.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,20 +170,17 @@ async function getPatientDetails(invite, itemDefs) {
170170
const patient = {
171171
invite,
172172
status: invite.status,
173+
username: null,
173174
inviteName: invite.displayName,
174175
createdAt: invite.dateCreation.toLocaleString(),
175176
dateCreation: invite.dateCreation // keep it as a date for sorting
176177
};
178+
console.log('## getPatientDetails.invite', invite, invite.status, invite.eventData.streamIds);
177179

178-
// -- get patient info
179-
try {
180-
const patientInfo = await invite.connection.accessInfo();
181-
patient.username = patientInfo.user.username;
182-
} catch (e) {
183-
console.error("## Error getting patient info from invite ", patient, invite, e);
184-
// -- mark as revoked
185-
// TODO call invite.markRevoked();
186-
}
180+
// --
181+
const patientInfo = await invite.checkAndGetAccessInfo();
182+
if (patientInfo === null) return patient;
183+
patient.username = patientInfo.user.username;
187184

188185
// -- get data
189186

patient-home-controler.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ async function showFormDetails(collectorClient) {
148148
buttonRevoke.innerHTML = 'Revoke';
149149
buttonRevoke.onclick = async function () {
150150
const doRevoke = confirm('Revoke ?');
151-
if (doRevoke) patientHomeLib.revokeAccess(collectorClient);
151+
if (doRevoke) await collectorClient.revoke();;
152152
refresh();
153153
};
154154
}
@@ -168,8 +168,8 @@ async function showFormDetails(collectorClient) {
168168
};
169169
buttonRevoke.innerHTML = 'Refuse';
170170
buttonRevoke.onclick = async function () {
171-
const doRevoke = confirm('Refuse ?');
172-
if (doRevoke) patientHomeLib.revokeAccess(requestData);
171+
const deRefuse = confirm('Refuse ?');
172+
if (deRefuse) await collectorClient.refuse();
173173
refresh();
174174
}
175175
}

0 commit comments

Comments
 (0)