update for build
This commit is contained in:
@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
|
||||
import { Component, computed, ContentChild, inject, Renderer2, TemplateRef } from '@angular/core';
|
||||
import { NavigationEnd, Router, RouterModule } from '@angular/router';
|
||||
import { filter, Subscription } from 'rxjs';
|
||||
import config from 'src/config';
|
||||
import { LayoutService } from '../service/layout.service';
|
||||
import { AppFooter } from './app.footer.component';
|
||||
import { AppSidebar } from './app.sidebar.component';
|
||||
@@ -137,29 +138,33 @@ export class AppLayout {
|
||||
this.layoutService.topbarCenterSlot$.subscribe((tpl) => (this.topBarCenterAction = tpl));
|
||||
this.layoutService.topbarEndSlot$.subscribe((tpl) => (this.topBarEndAction = tpl));
|
||||
|
||||
// if (window.location.pathname === '/') {
|
||||
// if (!this.authService.currentAccount()) {
|
||||
// this.router.navigateByUrl('auth');
|
||||
// }
|
||||
// switch (this.authService.currentAccount()?.type) {
|
||||
// case 'ADMIN':
|
||||
// this.router.navigateByUrl('super_admin');
|
||||
// break;
|
||||
// case 'CONSUMER':
|
||||
// if (this.authService.currentAccount()?.role === 'OWNER')
|
||||
// this.router.navigateByUrl('consumer');
|
||||
// // else {
|
||||
// // this.router.navigateByUrl('pos');
|
||||
// // }
|
||||
// break;
|
||||
// case 'PARTNER':
|
||||
// this.router.navigateByUrl('partner');
|
||||
// break;
|
||||
// case 'PROVIDER':
|
||||
// this.router.navigateByUrl('provider');
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
if (window.location.pathname === '/') {
|
||||
if (!this.authService.currentAccount()) {
|
||||
this.router.navigateByUrl('auth');
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
this.router.navigateByUrl(redirectUrl);
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
||||
Reference in New Issue
Block a user