diff --git a/src/views/DefaultPage.vue b/src/views/DefaultPage.vue index 7dcde3d4..a67b91b3 100644 --- a/src/views/DefaultPage.vue +++ b/src/views/DefaultPage.vue @@ -17,16 +17,22 @@ import PosDepartmentStepMobile1Location const hiarchyAccessLevels = { superuser: { name: 'superuser', - level: 3, + level: 4, access: computed(() => SessionUser.canAccessSuperUser()), route: 'superuser' }, admin: { name: 'admin', - level: 2, + level: 3, access: computed(() => SessionUser.canAccessAdmin()), route: 'admin' }, + subuser: { + name: 'subuser', + level: 2, + access: computed(() => SessionUser.isSubuser.value && SessionUser.initiated.value), + route: 'dashboard' + }, user: { name: 'user', level: 1, @@ -112,6 +118,15 @@ watch(() => SessionUser.permissions.value, (newValue) => { } }); +// Watch for changes in the subuser status +watch(() => SessionUser.isSubuser.value, (newValue) => { + if (newValue !== undefined) { + console.log('Subuser status changed, attempting redirect'); + // If the subuser status changes, attempt to redirect + attemptRedirect(); + } +}); + // Watch for changes in the attemptAutoSelectDepartment flag (to start the timeout for location fetching) watch(attemptAutoSelectDepartment, (newValue) => { if (newValue) {