Yuri
Headers aren't available in asyncData
Hello.
I have an old project on Nuxt 2. It works as SPA.
I have plagin
{ src: '~/plugins/nuxt-client-init.ts', ssr: false, } And I have page/index.vue I receive in the console: Token is recieved in nuxtServerInit. Why is the token in ASYNCDATA is unavailable? What can I do to make sure the token is available when the request in asyncData executed?
{ src: '~/plugins/nuxt-client-init.ts', ssr: false, } And I have page/index.vue I receive in the console: Token is recieved in nuxtServerInit. Why is the token in ASYNCDATA is unavailable? What can I do to make sure the token is available when the request in asyncData executed?
15 replies
Jest: Property '$style' does not exist on type 'Vue'
Hello.
There is a project in Nuxt 2.
I have a component is module CSS :
And I want to check that this class exist. My test is:
But I recieve the error:
What is correct way to check if such class exists?
9 replies
The plugin is executed twice
Hello.
I have the plugin (), which generates (or refreshes) a token. But it is executed twice: on the server and on the client. But I need the plugin start only once. If it was executed on the server, it should not be executed on the client.
But also I use SPA of this project for mobile app (Capacitor) and I can't to rename plugin to because in this case the plugin have to start on the client.
What are the appropriate options to solve my problem?
4 replies
JWT generation
Hello. I create an e-commerce project. I want to use JWT (access & refresh) for everybody (guests & users). Also I want to use
/server/api
. I create plugins/api.ts
for custom fetch.
I guess to create /server/api/token/get
& /server/api/token/refresh/
for working with tokens.
My questions:
1. Where do I need first request to token/get
for getting the token pair?
2. When the page loads I need to check "Does the cookie refreshToken
exist?" If YES I need to fetch /token/refresh/
. Where do I need to do it?
Maybe is there some ready solution?6 replies
mountSuspended & useCookie
Hello. Why my test show incorrect value for cookie?
Log:
Mock useCookie with value 0
Mock useCookie with value 1
locationConfirmationIsHidden (there isn't cookie): 1
locationConfirmationIsHidden (there is cookie): 1
Part of my component:
My test:
5 replies