]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
chore: example in playground router setup [skip ci]
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 13 Feb 2023 09:00:25 +0000 (10:00 +0100)
committerEduardo San Martin Morote <posva@users.noreply.github.com>
Wed, 15 Feb 2023 09:52:57 +0000 (10:52 +0100)
packages/playground/src/composables/router.ts [new file with mode: 0644]

diff --git a/packages/playground/src/composables/router.ts b/packages/playground/src/composables/router.ts
new file mode 100644 (file)
index 0000000..a6a74d7
--- /dev/null
@@ -0,0 +1,9 @@
+import { getActivePinia } from 'pinia'
+
+export function useRouter() {
+  return getActivePinia()?._a.config.globalProperties.$router!
+}
+
+export function useRoute() {
+  return getActivePinia()?._a.config.globalProperties.$route!
+}