useI18n() must be called at the top of a setup
function (in pinia store)
#15185
Replies: 2 comments
-
Experienced the same issue in Nuxt. As a workaround I've imported useNuxtApp in store.
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Reproduction repo no longer available... Closing. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Good evening everyone,
I have an issue with Pinia stores and Vue Router.
When I use useI18n inside a Pinia store (composition api) and access the store in Router.beforeEach() at the same time, it cause the following error:
Reproduction repository: https://github.com/yxyx-github/pinia-use-i18n-issue
Do you know why this happens?
As an alternate in the store I could do:
import i18n from 'src/locale/index'
and then:
i18n.global.t
but I'm still confused about this. It would be great if someone of you could explain to me, why this error happens.
Thanks in advance.
Best regards
yxyx-github
Beta Was this translation helpful? Give feedback.
All reactions