From fe42f3d594682a9a40bd0d2a66830dbe1e697498 Mon Sep 17 00:00:00 2001 From: mikkojamG Date: Tue, 15 Oct 2024 12:54:10 +0300 Subject: [PATCH] chore: fixing lint errors TETP-227 --- .../youth/src/components/cookieConsent/CookieConsent.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/tet/youth/src/components/cookieConsent/CookieConsent.tsx b/frontend/tet/youth/src/components/cookieConsent/CookieConsent.tsx index 4205af42ca..a8376998f3 100644 --- a/frontend/tet/youth/src/components/cookieConsent/CookieConsent.tsx +++ b/frontend/tet/youth/src/components/cookieConsent/CookieConsent.tsx @@ -63,10 +63,14 @@ const CookieConsent: React.FC<{ asPage?: boolean }> = ({ asPage = false }) => { window._paq.push(['requireConsent']); // eslint-disable-next-line no-underscore-dangle, unicorn/no-array-push-push window._paq.push(['requireCookieConsent']); + // eslint-disable-next-line sonarjs/no-collapsible-if } else if (consents.matomo === false) { // tell matomo to forget conset - // eslint-disable-next-line no-underscore-dangle, unicorn/no-array-push-push - window._paq.push(['forgetConsentGiven']); + // eslint-disable-next-line no-underscore-dangle, unicorn/no-lonely-if + if (window && window._paq) { + // eslint-disable-next-line no-underscore-dangle, unicorn/no-array-push-push + window._paq.push(['forgetConsentGiven']); + } } }, focusTargetSelector: '#main_content',