function setCookie()

in content/assets/javascripts/groups.js [29:38]


  function setCookie(cookieName, cookieValue, daysToExpire) {
    if (!daysToExpire) daysToExpire = 365;
    const now = new Date();
    now.setDate(now.getDate() + daysToExpire);
    // The lax value will send the cookie for all same-site
    // requests and top-level navigation GET requests. This
    // is sufficient for user tracking, but it will prevent
    // many CSRF attacks. This is the default value in modern browsers.
    document.cookie = `${cookieName}=${encodeURIComponent(cookieValue)};expires=${now.toUTCString()};path=/;samesite=lax`;
  }