JSFiddle - React, Tailwind, and code Playground
by Diana Lemen
HTML
<script src="https://github.com/QubitProducts/cookieman/blob/master/lib/cookieman.js"></script>
JavaScript
const cm = cookieman.js;
function setCookie(data, targetWeek) {
// console.log('setting cookie')
cm.set(`${COOKIE_PREFIX}-${customerUsername}-${targetWeek}`, data ? data.replace(/;/g, '-') : 'false', {
expires: new Date(new Date().getTime() + 120000),
path: '/',
domain: cookieDomain,
})
}
function getCookie(targetWeek) {
// console.log('getting cookie')
const cookie = cm.get(`${COOKIE_PREFIX}-${customerUsername}-${targetWeek}`)
return cookie.length ? cookie[0].value.replace(/-/g,';') : false
}
getCookie('sldk;lskdlsk')