]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
docs: fix the name of the store initialization (#2897)
authorBruno <72168158+bcostaaa01@users.noreply.github.com>
Fri, 31 Jan 2025 22:01:05 +0000 (23:01 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 10 Feb 2025 08:48:57 +0000 (09:48 +0100)
packages/docs/core-concepts/outside-component-usage.md

index e815922092af6941ec8cc6a2ec689718876e2614..97ddc53e55df4b3d604f3202e582e37b3a948ea7 100644 (file)
@@ -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'
 })