UI ประเมินผล
This commit is contained in:
parent
24ec62633a
commit
7e99b5fc4b
19 changed files with 1328 additions and 47 deletions
|
|
@ -1,55 +1,57 @@
|
|||
import { createRouter, createWebHistory } from "vue-router"
|
||||
import { createRouter, createWebHistory } from "vue-router";
|
||||
|
||||
const MainLayout = () => import("@/views/MainLayout.vue")
|
||||
const Dashboard = () => import("@/modules/01_dashboard/views/Dashboard.vue")
|
||||
const MainLayout = () => import("@/views/MainLayout.vue");
|
||||
const Dashboard = () => import("@/modules/01_dashboard/views/Dashboard.vue");
|
||||
|
||||
import ModuleTransfer from "@/modules/02_transfer/router.ts"
|
||||
import ModuleRetire from "@/modules/03_retire/router"
|
||||
import ModuleCheckin from "@/modules/04_checkin/router.ts"
|
||||
import ModuleLeave from "@/modules/05_leave/router.ts"
|
||||
import ModuleTransfer from "@/modules/02_transfer/router";
|
||||
import ModuleRetire from "@/modules/03_retire/router";
|
||||
import ModuleCheckin from "@/modules/04_checkin/router";
|
||||
import ModuleLeave from "@/modules/05_leave/router";
|
||||
import ModuAssesss from "@/modules/06_assess/router";
|
||||
// TODO: ใช้หรือไม่?
|
||||
import keycloak from "@/plugins/keycloak"
|
||||
import keycloak from "@/plugins/keycloak";
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
routes: [
|
||||
{
|
||||
path: "/",
|
||||
name: "home",
|
||||
component: MainLayout,
|
||||
children: [
|
||||
{
|
||||
path: "/",
|
||||
name: "dashboard",
|
||||
component: Dashboard,
|
||||
meta: {
|
||||
Auth: true,
|
||||
Key: [7],
|
||||
},
|
||||
},
|
||||
...ModuleTransfer,
|
||||
...ModuleRetire,
|
||||
...ModuleCheckin,
|
||||
...ModuleLeave
|
||||
],
|
||||
},
|
||||
],
|
||||
})
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
routes: [
|
||||
{
|
||||
path: "/",
|
||||
name: "home",
|
||||
component: MainLayout,
|
||||
children: [
|
||||
{
|
||||
path: "/",
|
||||
name: "dashboard",
|
||||
component: Dashboard,
|
||||
meta: {
|
||||
Auth: true,
|
||||
Key: [7],
|
||||
},
|
||||
},
|
||||
...ModuleTransfer,
|
||||
...ModuleRetire,
|
||||
...ModuleCheckin,
|
||||
...ModuleLeave,
|
||||
...ModuAssesss,
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (to.meta.Auth) {
|
||||
if (!keycloak.authenticated) {
|
||||
keycloak.login({
|
||||
redirectUri: `${window.location.protocol}//${window.location.host}${to.path}`,
|
||||
locale: "th",
|
||||
})
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
// next();
|
||||
})
|
||||
if (to.meta.Auth) {
|
||||
if (!keycloak.authenticated) {
|
||||
keycloak.login({
|
||||
redirectUri: `${window.location.protocol}//${window.location.host}${to.path}`,
|
||||
locale: "th",
|
||||
});
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
// next();
|
||||
});
|
||||
|
||||
export default router
|
||||
export default router;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue