Comments (5)
I see, are you using a session storage on your server, like express-session?
If so, you can create your vuex store with a store/index.js
file and add a nuxtServerInit
action where you can fill the state of your store from the req.session
, this action is called only from the server-side. Take a look at examples/auth-routes/store/index.js#L23
from nuxt.js.
Hi @antcook
Nuxt cannot access the localstorage from the server-side point indeed.
What kind of persistent state are you storing? It will help us to know what kind of solution it's better to use.
from nuxt.js.
It's a shopping cart, basically I want the the items in the cart to stay present when the browser is refreshed. Normally a thing I would do will localstorage.
Thanks for the quick reply! :)
from nuxt.js.
I was able to use express-session to store the cart state, thanks! :)
from nuxt.js.
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.
from nuxt.js.
Related Issues (20)
- Nuxt 3 - Convert `404.html` file to `404.shtml` on `Cpanel` hosting HOT 1
- nuxt generate is imported by "virtual:#internal/nitro/virtual/storage", but could not be resolved – treating it as an external dependency.
- https://nuxt.com isn't working on firefox HOT 2
- "No match found for location with path" is still spammed on unknown paths HOT 1
- Uncaught SyntaxError when building Nuxt.js 3.11.2 with Webpack HOT 1
- Docs: Nuxt Layers video update with latest one
- Docs: Nuxt Layers video update with latest one
- node .output/server/index.mjs error HOT 2
- Cannot find module from node_modules
- Move `@nuxt/ui-templates` into nuxt/nuxt monorepo
- Refreshed NuxtWelcome design (+ other error pages?)
- Resolve `runtimeConfig` within nuxt options
- public subfolder name collision with route causes 301 redirect HOT 1
- Unable to access logger in client or server from plugin HOT 1
- Error with `dist` symlink with SST Ion
- Navigating from router-view throws Missing required param
- Failed CSS preloads shouldn't throw errors
- Big bundle size due to jsdom canvas HOT 1
- 页面刷新 页面抖动
- ERROR (node:52837) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuxt.js.