This commit is contained in:
Muhammad Shahzad 2024-06-10 22:15:28 +05:00
parent 3f33811956
commit 9346a78600

View File

@ -4,9 +4,24 @@ const emailRouteComponent = () => import('@/pages/apps/email/index.vue')
export const redirects = [
// We are redirecting to different pages based on role.
// NOTE: Role is just for UI purposes. ACL is based on abilities.
{
path: '/admin',
// name: 'index',
redirect: to => {
// TODO: Get type from backend
const userData = useCookie('userData')
const userRole = userData.value?.role
if (userRole === 'admin')
return { name: 'admin-dashboard' }
if (userRole === 'client')
return { name: 'access-control' }
return { name: 'login', query: to.query }
},
},
{
path: '/',
name: 'index',
// name: 'index',
redirect: to => {
// TODO: Get type from backend
const userData = useCookie('userData')