Static GitHub Issues

[681] Help wanted about cookies-js

prev: Access to vue-meta head function while using vue-class-component
next: Isomorphic examples with data without axios?

in my store i have next code:

import Cookies from 'cookies-js'

const state = {
  user: null,
  token: Cookies('token') ? Cookies('token') : null
}
export default {
  state,
  mutations
}

end i can see next error:

Nuxt.js Error:

Error: Cookies.js requires a `window` with a `document` object
    at factory (D:\prj\nuxt\node_modules\cookies-js\dist\cookies.js:12:19)
    at Object.module.exports.Object.defineProperty.value (store/user.js:9:17)
    at __webpack_require__ (webpack:/webpack/bootstrap dfe6cf738e49c9418da8:25:0)
    at webpackContext (webpack:/store ^\.\/.*\.js$:6:0)
    at getModule (.nuxt/store.js:9:13)
    at Object.module.exports.Object.defineProperty.value (.nuxt/store.js:50:19)
    at __webpack_require__ (webpack:/webpack/bootstrap dfe6cf738e49c9418da8:25:0)
    at Object.<anonymous> (server-bundle.js:805:68)
    at __webpack_require__ (webpack:/webpack/bootstrap dfe6cf738e49c9418da8:25:0)
    at Object.<anonymous> (server-bundle.js:1908:65)
    at __webpack_require__ (webpack:/webpack/bootstrap dfe6cf738e49c9418da8:25:0)
    at server-bundle.js:95:18
    at Object.<anonymous> (server-bundle.js:98:10)
    at evaluateModule (D:\prj\nuxt\node_modules\vue-server-renderer\build.js:6967:21)
    at D:\prj\nuxt\node_modules\vue-server-renderer\build.js:6985:15
    at D:\prj\nuxt\node_modules\vue-server-renderer\build.js:6983:12

but i see examples with this code snd it work... what i can do for work with cookies-js?

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c591">#c591</a>)</em></sub></div>