You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are, in fact, able to get the value, since you are getting null which is the initial value you gave it. What you are not doing is updating this value. Furthermore, you are not really supposed to directly assign a value to a ref(), you assign to its .value property inside a setter.
Describe the bug
In the cookie store defineNuxtRouteMiddleware method was used in nuxt3 unable to get to the store of value:
internationalStore:
export const useInternationalStore = defineStore(
'international',
() => {
const currentLanguageCode = ref(null)
},
{
persist: true
}
)
insomeMethod:
const internationalStore = useInternationalStore()
internationalStore.currentLanguageCode = 'en'
when I refresh the page
middleware:
const nuxtApp = useNuxtApp()
const internationalStore = useInternationalStore(nuxtApp.$pinia)
console.log(internationalStore.currentLanguageCode) // null
Reproduction
https://codesandbox.io/p/devbox/nuxt3-m4yfyk?file=%2Fnuxt.config.ts%3A6%2C1
System Info
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: