diff --git a/aidbox-forms-smart-launch/index.html b/aidbox-forms-smart-launch/index.html
index 4f7774b..c2b43ad 100644
--- a/aidbox-forms-smart-launch/index.html
+++ b/aidbox-forms-smart-launch/index.html
@@ -2,7 +2,7 @@
-
+
Aidbox Forms Smart App Launch
diff --git a/aidbox-forms-smart-launch/public/health-samurai.svg b/aidbox-forms-smart-launch/public/health-samurai.svg
new file mode 100644
index 0000000..c9a3c6c
--- /dev/null
+++ b/aidbox-forms-smart-launch/public/health-samurai.svg
@@ -0,0 +1,15 @@
+
+
diff --git a/aidbox-forms-smart-launch/src/hooks/use-client.jsx b/aidbox-forms-smart-launch/src/hooks/use-client.jsx
index 22b1228..b084ac1 100644
--- a/aidbox-forms-smart-launch/src/hooks/use-client.jsx
+++ b/aidbox-forms-smart-launch/src/hooks/use-client.jsx
@@ -1,6 +1,5 @@
import { createContext, useContext } from "react";
import { client, oauth2 } from "fhirclient";
-import { useLocation } from "react-router-dom";
import { useQuery } from "@tanstack/react-query";
export const clientId = "aidbox-forms";
@@ -33,15 +32,13 @@ export const useClient = () => {
};
export const ClientProvider = ({ children }) => {
- let location = useLocation();
-
const { data: client } = useQuery({
queryKey: ["client"],
queryFn: () => {
return oauth2.init({
clientId,
scope,
- redirectUri: location.pathname,
+ redirectUri: window.location.pathname,
});
},
retry: false,
diff --git a/aidbox-forms-smart-launch/src/lib/utils.js b/aidbox-forms-smart-launch/src/lib/utils.js
index 76e7421..cde4e40 100644
--- a/aidbox-forms-smart-launch/src/lib/utils.js
+++ b/aidbox-forms-smart-launch/src/lib/utils.js
@@ -222,7 +222,7 @@ export function createSmartAppLauncherUrl({
export function unbundle(result) {
const resource =
- result.resourceType === "Bundle" ? result.entry[0]?.resource : result;
+ result.resourceType === "Bundle" ? result.entry?.[0]?.resource : result;
if (!resource) {
throw new Error("Resource not found");
diff --git a/aidbox-forms-smart-launch/src/pages/questionnaire-responses.jsx b/aidbox-forms-smart-launch/src/pages/questionnaire-responses.jsx
index 32cc218..37096a6 100644
--- a/aidbox-forms-smart-launch/src/pages/questionnaire-responses.jsx
+++ b/aidbox-forms-smart-launch/src/pages/questionnaire-responses.jsx
@@ -60,7 +60,7 @@ export const QuestionnaireResponses = () => {
const totalPages = Math.ceil(data.total / pageSize);
- const questionnaireResponse = data.entry.map((x) => x.resource);
+ const questionnaireResponse = data.entry?.map((x) => x.resource) || [];
const dummy = Symbol("dummy");
diff --git a/aidbox-forms-smart-launch/src/pages/questionnaires.jsx b/aidbox-forms-smart-launch/src/pages/questionnaires.jsx
index 2f6d3d1..a442ff2 100644
--- a/aidbox-forms-smart-launch/src/pages/questionnaires.jsx
+++ b/aidbox-forms-smart-launch/src/pages/questionnaires.jsx
@@ -60,10 +60,11 @@ export const Questionnaires = () => {
const totalPages = Math.ceil(data.total / pageSize);
- const questionnaires = data.entry.map((x) => ({
- publisher: "Health Samurai",
- ...x.resource,
- }));
+ const questionnaires =
+ data.entry?.map((x) => ({
+ publisher: "Health Samurai",
+ ...x.resource,
+ })) || [];
const [previewingQuestionnaire, setPreviewingQuestionnaire] = useState(null);