From: Bruno <72168158+bcostaaa01@users.noreply.github.com> Date: Fri, 31 Jan 2025 22:01:05 +0000 (+0100) Subject: docs: fix the name of the store initialization (#2897) X-Git-Tag: @pinia/nuxt@0.10.0~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7ad821b77708f2cf2910ffc42786569ec3617307;p=thirdparty%2Fvuejs%2Fpinia.git docs: fix the name of the store initialization (#2897) --- diff --git a/packages/docs/core-concepts/outside-component-usage.md b/packages/docs/core-concepts/outside-component-usage.md index e8159220..97ddc53e 100644 --- a/packages/docs/core-concepts/outside-component-usage.md +++ b/packages/docs/core-concepts/outside-component-usage.md @@ -42,7 +42,7 @@ const router = createRouter({ }) // ❌ Depending on the order of imports this will fail -const store = useStore() +const store = useUserStore() router.beforeEach((to, from, next) => { // we wanted to use the store here @@ -53,7 +53,7 @@ router.beforeEach((to, from, next) => { router.beforeEach((to) => { // ✅ This will work because the router starts its navigation after // the router is installed and pinia will be installed too - const store = useStore() + const store = useUserStore() if (to.meta.requiresAuth && !store.isLoggedIn) return '/login' })