Unique Situation
In my unique setup, I have a specific flow that involves storing a token in localStorage, even though I know it's not the recommended practice. Every time my Nuxt App is launched, I need to retrieve the token from localStorage, validate it via an API call, and set up the initial state accordingly.
Dilemma
The challenge arises because I am utilizing Server Side Rendering with Nuxt, which means that localStorage is inaccessible during server-side initialization.
Creative Solution
To address this issue, I have devised a workaround by creating an Action that performs the tasks outlined in the Unique Situation
, and then triggering this action from the mounted() method of layouts/default.vue
.
I welcome any suggestions for improving this workflow or feedback on whether this approach is appropriate.