Closed IvoPereira closed 3 years ago
Forget it. Turns out that somehow I had a target
property set to static
in my nuxt.config.js for some reason.
If anyone else stumbles on this, apart of target
that should be as server (if you are using SSR obviously), mode
should also be set to universal
(it is the Nuxt default).
Thanks!
Hi there!
I am using Vuex module mode and trying to set a cookie inside nuxtServerInit, but for some reason it does not seem to set anything at all.
A worth note, in server, it does not appear to log any kind of set cookie at all.
An example:
nuxtServerInit - store/index.js
Log in the server:
set-inside-nuxtServerInit => {}
Log in the client:
set-inside-plugin => {}
However, when trying to do the same inside a plugin I am perfectly able to do so (in the client):
plugin/example.js
Log in the server:
set-inside-plugin => {}
Log in the client:
set-inside-plugin => Object { "set-inside-plugin": "works!" }
If it helps, my nuxt.config.js modules section:
Now some questions:
1) Why does the cookie is set on a plugin and not in nuxtServerInit? Am I missing something? 2) Why does the cookie is set only on client and not on server?
Thanks!