update
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user