@springernature/global-javascript
Advanced tools
Comparing version 2.3.0 to 2.3.1
# History | ||
## 2.3.1 (2020-08-20) | ||
* BUG: Fix checkConsent util - Adds safety check for cookie existence | ||
## 2.3.0 (2020-07-14) | ||
@@ -4,0 +7,0 @@ * FEATURE: checkConsent util |
{ | ||
"name": "@springernature/global-javascript", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Globally shared Javascript helpers", |
@@ -23,6 +23,9 @@ import {getCookie} from './get-cookie'; | ||
const consent = getCookie('OptanonConsent'); | ||
const consentGroups = consent.split('groups=').pop().split('&')[0]; | ||
const colonEncoding = '%3A'; | ||
return consentGroups.includes(validCategories[category] + colonEncoding + '1'); | ||
if (consent) { | ||
const consentGroups = consent.split('groups=').pop().split('&')[0]; | ||
const colonEncoding = '%3A'; | ||
return consentGroups.includes(validCategories[category] + colonEncoding + '1'); | ||
} | ||
}; | ||
@@ -29,0 +32,0 @@ |
20372
432