docs(nx-dev): remove unused external script loader (#30978)
Removed the external JS script loader for a third-party B2B script as it is no longer required. This simplifies the `_app.tsx` file and avoids unnecessary script management during route changes.
This commit is contained in:
parent
a3415309b9
commit
413a01159f
@ -16,30 +16,6 @@ export default function CustomApp({
|
|||||||
}: AppProps): JSX.Element {
|
}: AppProps): JSX.Element {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const gaMeasurementId = 'UA-88380372-10';
|
const gaMeasurementId = 'UA-88380372-10';
|
||||||
// RB2B ---------
|
|
||||||
const SCRIPT_ID = 'external-js-script';
|
|
||||||
const SCRIPT_BASE_URL = 'https://s3-us-west-2.amazonaws.com/b2bjsstore/b/';
|
|
||||||
const SCRIPT_KEY = '0NW1GH7YJ4O4'; //
|
|
||||||
const SCRIPT_URL = `${SCRIPT_BASE_URL}${SCRIPT_KEY}/${SCRIPT_KEY}.js.gz`;
|
|
||||||
useEffect(() => {
|
|
||||||
const handleRouteChange = () => {
|
|
||||||
const existingScript = document.getElementById(SCRIPT_ID);
|
|
||||||
if (existingScript) {
|
|
||||||
existingScript.remove();
|
|
||||||
}
|
|
||||||
const script = document.createElement('script');
|
|
||||||
script.id = SCRIPT_ID;
|
|
||||||
script.src = SCRIPT_URL;
|
|
||||||
script.async = true;
|
|
||||||
document.body.appendChild(script);
|
|
||||||
};
|
|
||||||
router.events.on('routeChangeComplete', handleRouteChange);
|
|
||||||
handleRouteChange();
|
|
||||||
return () => {
|
|
||||||
router.events.off('routeChangeComplete', handleRouteChange);
|
|
||||||
};
|
|
||||||
}, [router.events, SCRIPT_URL]);
|
|
||||||
// ---------
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleRouteChange = (url: URL) =>
|
const handleRouteChange = (url: URL) =>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user