Skip to content

Commit 297d0b4

Browse files
committed
fixing table refresh
1 parent 4313f85 commit 297d0b4

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

dr-controler.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ async function showQuestionnary(questionaryId) {
9797
// document.getElementById('requestContent').innerHTML = JSON.stringify(status, null, 2);
9898
// forms sections
9999
const table = document.getElementById('forms-sections');
100+
table.innerHTML = '';
100101
const keyTitles = { type: 'Type', name: 'Name', itemKeys: 'ItemKeys'};
101102

102103
const forms = Object.values(status.requestContent.app.data.forms);
@@ -116,7 +117,7 @@ async function showQuestionnary(questionaryId) {
116117
}
117118
}
118119

119-
console.log('## showQuestionnary', status);
120+
console.log('## showQuestionnary status:', status);
120121

121122
// set create sharing button
122123
document.getElementById('button-new-sharing').onclick = async () => {
@@ -219,7 +220,7 @@ async function refreshPatientList(collector) {
219220
*/
220221
function getSharingLinkHTML(inviteSharingData) {
221222
const currentPage = window.location.href;
222-
const posDrHTML = currentPage.indexOf('dr2.html');
223+
const posDrHTML = currentPage.indexOf('dr.html');
223224
const patientURL = currentPage.substring(0, posDrHTML) + 'patient.html';
224225
const sharingLink = `${patientURL}?apiEndpoint=${inviteSharingData.apiEndpoint}&eventId=${inviteSharingData.eventId}`;
225226
const sharingMailBody = 'Hello,\n\nI am sending you a link to fill out a form.\nPlease click on the link below to access the form: \n\n' + sharingLink + '\n\nBest regards,\nYour Doctor';

patient-home-controler.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async function refresh() {
3030
const appClient = await stateGetApp('client');
3131
if (inviteParams) {
3232
const collectorClient = await appClient.handleIncomingRequest(inviteParams.apiEndpoint, inviteParams.eventId);
33-
console.log('>>## refresh: new incoming request', collectorClient);
33+
console.log('>>## refresh: new incoming request', collectorClient, collectorClient.key);
3434
}
3535
const collectorClients = await appClient.getCollectorClients();
3636
console.log('>>## refresh: collectorClients', collectorClients);
@@ -155,8 +155,16 @@ async function showFormDetails(collectorClient) {
155155
else {
156156
buttonOpen.innerHTML = 'Grant access and Open';
157157
buttonOpen.onclick = async function () {
158-
await collectorClient.accept();
159-
document.location.href = nextPage;
158+
try {
159+
const acceptResult = await collectorClient.accept();
160+
if (acceptResult == null) throw new Error('Accepted result is empty');
161+
console.log('## AcceptResult', acceptResult);
162+
alert('Access successfully granted');
163+
document.location.href = nextPage;
164+
} catch (e) {
165+
console.log(e);
166+
alert('Error accepting: ' + e.message);
167+
}
160168
};
161169
buttonRevoke.innerHTML = 'Refuse';
162170
buttonRevoke.onclick = async function () {

0 commit comments

Comments
 (0)