Feature/standardize ui display

This commit is contained in:
ISMAIL MASSERAN
2026-06-23 07:44:42 +00:00
parent a969d4bbcf
commit 378b00a1e6
25 changed files with 2883 additions and 54 deletions
+30 -3
View File
@@ -19,16 +19,34 @@ const router = new VueRouter({
routes
});
var publicVoterRouteNames = {
'Voter Login': true,
'Voter Verify': true,
'Physical Gate Display': true,
'Roulette Wheel Demo': true,
'penyata': true
};
router.beforeEach(function (to, from, next) {
if (to.name === 'Voter Login' && utilMethods.isAdminPortalSession()) {
var dest = utilMethods.getAdminEntryRoute();
return next(Object.assign({}, dest, { replace: true }));
}
if (!to.path.startsWith('/admin') || to.name === 'Admin Login') {
var isAdminRoute = to.path.indexOf('/admin') === 0;
var isPublicVoterRoute = !!publicVoterRouteNames[to.name]
|| to.path.indexOf('/display/') === 0
|| to.path.indexOf('/demo/') === 0;
if (!isAdminRoute && !isPublicVoterRoute && !utilMethods.isLogin()) {
return next({ name: 'Voter Login', replace: true });
}
if (!isAdminRoute || to.name === 'Admin Login') {
return next();
}
if (!localStorage.getItem('Access Token')) {
return next();
if (!utilMethods.isLogin()) {
return next({ name: 'Admin Login', replace: true });
}
var role = localStorage.getItem('admin_role');
if (role === '3' && to.name !== 'Kehadiran Calon') {
@@ -37,6 +55,15 @@ router.beforeEach(function (to, from, next) {
next();
});
axios.interceptors.response.use(function (response) {
return response;
}, function (error) {
if (error.response && error.response.status === 401) {
utilMethods.handleUnauthorized(router);
}
return Promise.reject(error);
});
const app = new Vue({
router
}).$mount('#app');