Frontend/src/router/index.ts

58 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-03-28 02:14:12 +00:00
// Composables
2024-03-28 06:08:17 +00:00
import { createRouter, createWebHistory } from "vue-router";
// import { useUserStore } from "@/stores/user";
// import { useConfigStore } from "@/stores/config";
const routes = [
{
path: "/",
name: "home",
meta: {
auth: true,
},
// route level code-splitting
// this generates a separate chunk (Home-[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import("@/views/Home.vue"),
},
];
2024-03-18 08:55:04 +00:00
const router = createRouter({
2024-03-28 06:08:17 +00:00
history: createWebHistory(process.env.BASE_URL),
routes,
});
// router.beforeEach((to, from) => {
//
// // get route name
// console.log(from.name, from.fullPath)
//
// const userStore = useUserStore();
// const configStore = useConfigStore();
//
// // if (to.matched.length === 0) {
// // return router.push({ name: "errors.404" });
// // }
//
// if (to.meta.title) {
// document.title = to.meta.title + " - " + configStore.getAppName();
// } else {
// document.title = configStore.getAppName();
// }
//
// if (to.meta.auth == true) {
// // validate login state
// if (userStore.jwt_token == null) {
// router.push({ name: "login" });
// }
// } else {
// document.title = configStore.getAppName();
// }
//
// return true;
//
// });
2024-03-26 03:19:47 +00:00
2024-03-28 06:08:17 +00:00
export default router;