I am using middleware to retrieve data from a cookie with the help of vue-cookies
.
try {
if (window.$cookies.get('region')) {
res.setHeader('Set-Cookie', [
`region=${window.$cookies.get('region')};path=/`
])
} else {
res.setHeader('Set-Cookie', [
`region=${process.env.DEFAULT_REGION};path=/`
])
}
} catch (e) {
console.log(e)
}
Everything is functioning correctly, but in the server terminal, I am seeing this error:
ReferenceError: window is not defined
at server.js:3102:7
at promisify (server.js:2522:15)
at middlewareSeries (server.js:2501:10)
at server.js:2502:12
at async module.exports../.nuxt/server.js.__webpack_exports__.default (server.js:1964:3)
Should I just ignore this error, or is there a way to fix it?