Skip to content

Commit

Permalink
Merge pull request #5 from IvoElgentos/main
Browse files Browse the repository at this point in the history
prevent console error on first domain visit
  • Loading branch information
WouterSteen authored Jun 17, 2024
2 parents 75591d7 + 3ee0c39 commit 75cef47
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/view/frontend/templates/cookie-banner-script.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ if (!$cookieHelper->isCookieRestrictionModeEnabled()) {
initialize() {
const cookies = JSON.parse(localStorage.getItem('consent-mode'));

//On a first domain visit consent-mode is not yet set so return to avoid a console error
if(!cookies) {
return;
}

this.consentConfig = {
necessary: cookies['functionality_storage'] === 'granted',
marketing: cookies['ad_storage'] === 'granted',
Expand Down

0 comments on commit 75cef47

Please sign in to comment.