-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get / set cookie from ssr without using server middleware #2215
Comments
You can get cookies from |
Yes, it is. First, you may use nuxt-ommunity/axios-module, it will make all the work automatically. Also you can do it manually, via Nuxt context injection, for example, in the async asyncData({req}) {
const headers = req && req.headers
const {data} = await axios('/api/entries', {headers: headers})
} So cookies along with other headers will be proxied to API server from a client, or you may filter only requried header and use it. |
Great!! |
I will use nuxt/axios module to store the token and other informations which will be shared with all my requests, but yes, the module do exactly the same thing you told me. |
¿Maybe an example of this? I trying to do the same, i need to storage session cookie |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hello,
I try to find a solution, but I'm not sure that it really exists. I have a distant api, so I don't need/want to use any api on the server side using server middleware, I just want to set / get cookies or data on local storage from my store.
Is it possible ?
The text was updated successfully, but these errors were encountered: