38 lines
887 B
JavaScript
Vendored
38 lines
887 B
JavaScript
Vendored
require('./bootstrap.js');
|
|
require('./helper/autocloseMenu.js');
|
|
//window.VueRouter = require('vue-router').default;
|
|
//import VueRouter from 'vue-router';
|
|
import Util from './util.js';
|
|
import routes from './routesIndex.js';
|
|
import OtpInput from "@bachdgvn/vue-otp-input";
|
|
|
|
Vue.component("v-otp-input", OtpInput);
|
|
|
|
Vue.use(VueRouter);
|
|
Vue.mixin(Util);
|
|
Vue.use(OtpInput);
|
|
|
|
const router = new VueRouter({
|
|
mode: 'history',
|
|
linkActiveClass: 'active',
|
|
routes
|
|
});
|
|
|
|
router.beforeEach(function (to, from, next) {
|
|
if (!to.path.startsWith('/admin') || to.name === 'Admin Login') {
|
|
return next();
|
|
}
|
|
if (!localStorage.getItem('Access Token')) {
|
|
return next();
|
|
}
|
|
var role = localStorage.getItem('admin_role');
|
|
if (role === '3' && to.name !== 'Kehadiran Calon') {
|
|
return next({ name: 'Kehadiran Calon', replace: true });
|
|
}
|
|
next();
|
|
});
|
|
|
|
const app = new Vue({
|
|
router
|
|
}).$mount('#app');
|