Skip to content

Commit 75cef47

Browse files
authored
Merge pull request #5 from IvoElgentos/main
prevent console error on first domain visit
2 parents 75591d7 + 3ee0c39 commit 75cef47

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/view/frontend/templates/cookie-banner-script.phtml

+5
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ if (!$cookieHelper->isCookieRestrictionModeEnabled()) {
6767
initialize() {
6868
const cookies = JSON.parse(localStorage.getItem('consent-mode'));
6969

70+
//On a first domain visit consent-mode is not yet set so return to avoid a console error
71+
if(!cookies) {
72+
return;
73+
}
74+
7075
this.consentConfig = {
7176
necessary: cookies['functionality_storage'] === 'granted',
7277
marketing: cookies['ad_storage'] === 'granted',

0 commit comments

Comments
 (0)