0👍
you can use typeof window === 'undefined'
to determine if it running in Server Side, and skip the code you only want to run in client, just like:
if (typeof window !== 'undefined') {
// your code
}
You can use it in created
/beforeCreate
/asyncData
, And if you code is in mounted(), you may not need do this, ‘case this Lifecycle Hooks only run in the client.
- [Vuejs]-Quasar q-tabs: how to dynamically show/hide q-tab by code?
- [Vuejs]-How to disable v-pagination when there are not items VUEJS + VUETIFY
0👍
You can write a Middleware and dispatch your action that checks the token in it and call it in the layout.
https://nuxtjs.org/docs/2.x/directory-structure/middleware
- [Vuejs]-Vuejs router redirect in beforeEach
- [Vuejs]-Cant set cookie. Providing full code on codeSandBox of a back and a front. Does anybody see an issue. Thank you! Express + Vue 3
Source:stackexchange.com