diff --git a/adyencheckoutaddonspa/acceleratoraddon/web/webroot/_ui/responsive/common/js/adyen-checkout/src/index.js b/adyencheckoutaddonspa/acceleratoraddon/web/webroot/_ui/responsive/common/js/adyen-checkout/src/index.js index d59df234..20715cc5 100644 --- a/adyencheckoutaddonspa/acceleratoraddon/web/webroot/_ui/responsive/common/js/adyen-checkout/src/index.js +++ b/adyencheckoutaddonspa/acceleratoraddon/web/webroot/_ui/responsive/common/js/adyen-checkout/src/index.js @@ -8,16 +8,21 @@ import {RouterProvider} from "react-router-dom"; import {router} from "./router/router" -const root = ReactDOM.createRoot(document.getElementById('root')); -root.render( - - +const rootElement = document.getElementById('root'); + +if (rootElement) { + const root = ReactDOM.createRoot(rootElement); + root.render( + + - - -); + + + ); + + // If you want to start measuring performance in your app, pass a function + // to log results (for example: reportWebVitals(console.log)) + // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals + reportWebVitals(); +} -// If you want to start measuring performance in your app, pass a function -// to log results (for example: reportWebVitals(console.log)) -// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals -reportWebVitals(); diff --git a/adyencheckoutaddonspa/acceleratoraddon/web/webroot/_ui/responsive/common/js/adyen-checkout/src/util/baseUrlUtil.ts b/adyencheckoutaddonspa/acceleratoraddon/web/webroot/_ui/responsive/common/js/adyen-checkout/src/util/baseUrlUtil.ts index 9690ead8..819e0be6 100644 --- a/adyencheckoutaddonspa/acceleratoraddon/web/webroot/_ui/responsive/common/js/adyen-checkout/src/util/baseUrlUtil.ts +++ b/adyencheckoutaddonspa/acceleratoraddon/web/webroot/_ui/responsive/common/js/adyen-checkout/src/util/baseUrlUtil.ts @@ -3,4 +3,4 @@ declare var ACC: any; export const urlContextPath: string = ACC.config.encodedContextPath const rootElement = document.getElementById('root'); -export const CSRFToken = rootElement.getAttribute('csrf-token'); +export const CSRFToken = rootElement ? rootElement.getAttribute('csrf-token') : undefined;