This commit is contained in:
2026-05-11 15:59:57 +03:30
parent 7b3a27110a
commit 3e48e8fd5c
5 changed files with 57 additions and 31 deletions
+25 -21
View File
@@ -138,32 +138,36 @@ export class AppLayout {
this.layoutService.topbarCenterSlot$.subscribe((tpl) => (this.topBarCenterAction = tpl));
this.layoutService.topbarEndSlot$.subscribe((tpl) => (this.topBarEndAction = tpl));
console.log(this.authService.currentAccount());
if (window.location.pathname === '/') {
if (!this.authService.currentAccount()) {
this.router.navigateByUrl('auth');
}
} else {
let redirectUrl = '';
let redirectUrl = '';
switch (this.authService.currentAccount()?.type) {
case 'ADMIN':
redirectUrl = '/super_admin';
break;
case 'PROVIDER':
redirectUrl = '/provider';
break;
case 'PARTNER':
redirectUrl = '/partner';
break;
case 'CONSUMER':
if (this.authService.currentAccount()?.role === 'OWNER') {
redirectUrl = '/consumer';
} else {
redirectUrl = config.isPosApplication ? '/' : '/pos';
}
break;
switch (this.authService.currentAccount()?.type) {
case 'ADMIN':
redirectUrl = '/super_admin';
break;
case 'PROVIDER':
redirectUrl = '/provider';
break;
case 'PARTNER':
redirectUrl = '/partner';
break;
case 'CONSUMER':
if (this.authService.currentAccount()?.role === 'OWNER') {
redirectUrl = '/consumer';
} else {
redirectUrl = config.isPosApplication ? '/' : '/pos';
}
break;
}
if (redirectUrl) {
this.router.navigateByUrl(redirectUrl);
}
}
this.router.navigateByUrl(redirectUrl);
}
}