Skip to content

Commit

Permalink
mh
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-reynolds committed May 18, 2024
1 parent b21c879 commit 44f5adf
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions example-smart-app/src/js/example-smart-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,17 +243,16 @@ function onReady(smart) {
console.error("Failed to read questionnaire data:", questionnaireError);
}

var patient = patientError ? null : patientData[0];
var questionnaire = questionnaireError ? defaultQuestionnaire : questionnaireData[0];

if (patient) {
createQuestionnaireForm(questionnaire);
document.getElementById("submit-button").onclick = function() {
submitQuestionnaire(patient.id, questionnaire);
};
} else {
if (patientError) {
console.error("Cannot proceed without patient data.");
return;
}

var questionnaire = questionnaireError ? defaultQuestionnaire : questionnaireData[0];
createQuestionnaireForm(questionnaire);
document.getElementById("submit-button").onclick = function() {
submitQuestionnaire(patientData[0].id, questionnaire);
};
});
} else {
console.error("SMART FHIR client does not have patient context.");
Expand Down

0 comments on commit 44f5adf

Please sign in to comment.