From ee021c2ac9675d5b9eb7b739ed660dfdc97a5783 Mon Sep 17 00:00:00 2001 From: Philip Ellis Date: Wed, 4 Dec 2024 13:37:53 -0500 Subject: [PATCH 1/4] fixed function call --- src/components/PostmanLink.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PostmanLink.js b/src/components/PostmanLink.js index f412e3e490eb..518e523afb17 100644 --- a/src/components/PostmanLink.js +++ b/src/components/PostmanLink.js @@ -9,7 +9,7 @@ export default function CMSLinkComponent({children, source}) { useEffect(() => { const fetchFileContent = async () => { try { - const response = await getV2024(siteConfig.customFields.CMS_APP_API_ENDPOINT); + const response = await getItem(siteConfig.customFields.CMS_APP_API_ENDPOINT); //const response = await getItem('https://lyna7x4y34.execute-api.us-east-1.amazonaws.com/Prod/', source); if (response.id) { const content = response.Item From 4fb84f6670f236db362cc955e565049c3b25ee2e Mon Sep 17 00:00:00 2001 From: Philip Ellis Date: Wed, 4 Dec 2024 15:04:16 -0500 Subject: [PATCH 2/4] added logging --- src/components/PostmanLink.js | 2 +- src/services/CMSService.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/PostmanLink.js b/src/components/PostmanLink.js index 518e523afb17..5f84f3cc5878 100644 --- a/src/components/PostmanLink.js +++ b/src/components/PostmanLink.js @@ -15,7 +15,7 @@ export default function CMSLinkComponent({children, source}) { const content = response.Item setFileContent(content); } else { - console.error('Error fetching GitHub file:', response.statusText); + console.error('Error fetching GitHub file:', response); } } catch (error) { console.error('Error fetching GitHub file:', error); diff --git a/src/services/CMSService.js b/src/services/CMSService.js index 40f5b24e00c3..3fa7ab77f449 100644 --- a/src/services/CMSService.js +++ b/src/services/CMSService.js @@ -11,10 +11,11 @@ export async function getBanner(cmsurl) { export async function getItem(cmsurl, itemId) { try { + console.log(cmsurl + itemId); const response = await fetch(cmsurl + itemId); return await response.json(); } catch (error) { - return []; + return ""; } } From cd1ca403dafb43420b3114fbd4000fb550135a7f Mon Sep 17 00:00:00 2001 From: Philip Ellis Date: Wed, 4 Dec 2024 15:33:35 -0500 Subject: [PATCH 3/4] added more logging --- src/components/PostmanLink.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/PostmanLink.js b/src/components/PostmanLink.js index 5f84f3cc5878..f7c54783b6fa 100644 --- a/src/components/PostmanLink.js +++ b/src/components/PostmanLink.js @@ -9,6 +9,9 @@ export default function CMSLinkComponent({children, source}) { useEffect(() => { const fetchFileContent = async () => { try { + console.log(siteConfig); + console.log(siteConfig.customFields); + console.log(siteConfig.customFields.CMS_APP_API_ENDPOINT); const response = await getItem(siteConfig.customFields.CMS_APP_API_ENDPOINT); //const response = await getItem('https://lyna7x4y34.execute-api.us-east-1.amazonaws.com/Prod/', source); if (response.id) { From ebcc7100ab9781b27f2da460be5a387d7833c25a Mon Sep 17 00:00:00 2001 From: Philip Ellis Date: Wed, 4 Dec 2024 16:04:01 -0500 Subject: [PATCH 4/4] fixed source passing --- src/components/PostmanLink.js | 5 +---- src/services/CMSService.js | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/components/PostmanLink.js b/src/components/PostmanLink.js index f7c54783b6fa..10bfd6a2c751 100644 --- a/src/components/PostmanLink.js +++ b/src/components/PostmanLink.js @@ -9,10 +9,7 @@ export default function CMSLinkComponent({children, source}) { useEffect(() => { const fetchFileContent = async () => { try { - console.log(siteConfig); - console.log(siteConfig.customFields); - console.log(siteConfig.customFields.CMS_APP_API_ENDPOINT); - const response = await getItem(siteConfig.customFields.CMS_APP_API_ENDPOINT); + const response = await getItem(siteConfig.customFields.CMS_APP_API_ENDPOINT, source); //const response = await getItem('https://lyna7x4y34.execute-api.us-east-1.amazonaws.com/Prod/', source); if (response.id) { const content = response.Item diff --git a/src/services/CMSService.js b/src/services/CMSService.js index 3fa7ab77f449..6c5beaeb331e 100644 --- a/src/services/CMSService.js +++ b/src/services/CMSService.js @@ -11,7 +11,6 @@ export async function getBanner(cmsurl) { export async function getItem(cmsurl, itemId) { try { - console.log(cmsurl + itemId); const response = await fetch(cmsurl + itemId); return await response.json(); } catch (error) {