19 lines
444 B
TypeScript
19 lines
444 B
TypeScript
import { defineStore } from "pinia";
|
|
import { useRoute } from "vue-router";
|
|
import { RouteLocationRaw, useRouter } from "vue-router";
|
|
export const useRouterStore = defineStore("router", () => {
|
|
const route = useRoute();
|
|
const router = useRouter();
|
|
|
|
const getCurrentPath = () => {
|
|
return route.path;
|
|
};
|
|
const toPath = (params: RouteLocationRaw) => {
|
|
router.push(params);
|
|
};
|
|
return {
|
|
getCurrentPath,
|
|
toPath
|
|
};
|
|
});
|