From 8b10c3ec1728a84cfc37c75428841b33900014dc Mon Sep 17 00:00:00 2001 From: Kenny Krug Date: Mon, 23 Sep 2024 14:08:10 -0400 Subject: [PATCH] javascript console errors - challenge.gov #1434 --- assets/client/src/index.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/assets/client/src/index.js b/assets/client/src/index.js index b92c508a..56fbfa84 100644 --- a/assets/client/src/index.js +++ b/assets/client/src/index.js @@ -60,12 +60,13 @@ const renderRouter = () => ( ) const rootElement = document.getElementById('challenge-gov-react-app') -const apiUrl = encodeURI(rootElement.getAttribute('data-api-url')) -const publicUrl = rootElement.getAttribute('data-public-url') -const imageBase = encodeURI(rootElement.getAttribute('data-image-base')) -const bridgeApplyBlocked = rootElement.getAttribute('data-bridge-apply-blocked') != 'false' - -ReactDOM.render(renderRouter(), rootElement); +if (rootElement){ + const apiUrl = encodeURI(rootElement.getAttribute('data-api-url')) + const publicUrl = rootElement.getAttribute('data-public-url') + const imageBase = encodeURI(rootElement.getAttribute('data-image-base')) + const bridgeApplyBlocked = rootElement.getAttribute('data-bridge-apply-blocked') != 'false' + ReactDOM.render(renderRouter(), rootElement); +} // If you want your app to work offline and load faster, you can change // unregister() to register() below. Note this comes with some pitfalls.