Sha256: 78221cb7d4a4e1905b8afbb1192e1577e880af68ba9e7d69b9a8019654be4a72

Contents?: true

Size: 616 Bytes

Versions: 89

Compression:

Stored size: 616 Bytes

Contents

export default class {
  setCookie (cname, cvalue, exdays) {
    const d = new Date()
    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000))
    const expires = 'expires=' + d.toUTCString()
    document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/'
  }

  getCookie (cname) {
    const name = cname + '='
    const ca = document.cookie.split(';')
    for (let i = 0; i < ca.length; i++) {
      let c = ca[i]
      while (c.charAt(0) === ' ') {
        c = c.substring(1)
      }
      if (c.indexOf(name) === 0) {
        return c.substring(name.length, c.length)
      }
    }
    return ''
  }
}

Version data entries

89 entries across 89 versions & 1 rubygems

Version Path
pg_rails-7.1.1.pre.3 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.1.1.pre.2 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.1.1.pre.1 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.1.0 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.112 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.111 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.110 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.109 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.108 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.107 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.106 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.105 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.104 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.103 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.102 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.101 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.100 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.99 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.98 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.97 pg_layout/app/javascript/utils/cookies.js