cluedin-widget
Version:
This project contains all the pages needed for browsing entities and searching them. The aim is to replace the CluedIn.Webapp project with this one when all the pages ( including the Admin page ) will be ported to REACT.
30 lines (26 loc) • 799 B
JavaScript
var getCookie = (sName) => {
sName = sName.toLowerCase();
var oCrumbles = document.cookie.split(';');
for (var i = 0; i < oCrumbles.length; i++) {
var oPair = oCrumbles[i].split('=');
var sKey = decodeURIComponent(oPair[0].trim().toLowerCase());
var sValue = oPair.length > 1 ? oPair[1] : '';
if (sKey == sName)
return decodeURIComponent(sValue);
}
return '';
};
var setCookie = (sName, sValue) => {
var oDate = new Date();
oDate.setYear(oDate.getFullYear() + 1);
var sCookie = encodeURIComponent(sName) + '=' + encodeURIComponent(sValue) + ';expires=' + oDate.toGMTString() + ';path=/';
document.cookie = sCookie;
};
var clearCookie = (sName) => {
setCookie(sName, '');
};
module.exports = {
get: getCookie,
set: setCookie,
clear: clearCookie,
};