Files
notifications-admin/app/assets/javascripts/consent.js
Tom Byers 8fd9686c3d Add consent tracking to cookie functions
Taken from GOVUK components:

https://github.com/alphagov/govuk_publishing_components/blob/master/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js

Also includes:
- make new cookie functions handle notify domains
- addition of hasConsentFor function to allow easy
  checking of consent for categories of cookie
2020-01-03 17:28:33 +00:00

16 lines
361 B
JavaScript

(function (window) {
"use strict";
function hasConsentFor (cookieCategory) {
const consentCookie = window.GOVUK.getConsentCookie();
if (consentCookie === null) { return false; }
if (!(cookieCategory in consentCookie)) { return false; }
return consentCookie[cookieCategory];
}
window.GOVUK.hasConsentFor = hasConsentFor;
})(window);