Im working on a website with language being detected and managed by i18next, and user being managed by a custom session based express middleware.
Let's say I have my store taking the current User from the req object in nuxtServerInit like that
if (req.user)
commit('setUser', req.user);
It works. Same to get the current language. But now, I need the store to load a configuration JSON depending on the language so I now have in nuxtServerInit:
const res = await axios.get(
/api/config/);
commit('setConfig', res.data);
And the language is supposed to be handled by i18n based on session.
The call works great.... except that the request made to the server being called by the server itself, it loses it's context based on session. I just cant retrieve any localized content in store or page on SSR for that reason, same for any "user based" content.
I can't find a way to make the session to be "passed" we my API is being called by nuxt on server side.
Anyone have an idea on that ?
<!--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/c1466">#c1466</a>)</em></sub></div>