refactor user accounts structure

This commit is contained in:
2026-03-16 00:35:34 +03:30
parent 20be653499
commit 3c9f6eed1d
286 changed files with 2812 additions and 1133 deletions
@@ -1,4 +1,4 @@
import { BreadcrumbService } from '@/core/services';
import { AuthService, BreadcrumbService } from '@/core/services';
import { BreadcrumbComponent } from '@/shared/components';
import { CommonModule } from '@angular/common';
import {
@@ -11,7 +11,7 @@ import {
TemplateRef,
ViewChild,
} from '@angular/core';
import { NavigationEnd, Router, RouterModule } from '@angular/router';
import { ActivatedRoute, NavigationEnd, Router, RouterModule } from '@angular/router';
import { ProgressSpinner } from 'primeng/progressspinner';
import { filter, Subscription } from 'rxjs';
import { LayoutService } from '../service/layout.service';
@@ -46,6 +46,8 @@ export class AppLayout {
@ContentChild('content', { static: true }) content?: TemplateRef<any> | null;
private breadcrumbService = inject(BreadcrumbService);
private authService = inject(AuthService);
private route = inject(ActivatedRoute);
constructor(
public layoutService: LayoutService,
@@ -141,6 +143,28 @@ export class AppLayout {
return this.layoutService.menuItems().length > 0;
});
ngOnInit() {
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':
this.router.navigateByUrl('consumer');
break;
case 'PARTNER':
this.router.navigateByUrl('partner');
break;
case 'PROVIDER':
this.router.navigateByUrl('provider');
break;
}
}
}
ngOnDestroy() {
if (this.overlayMenuOpenSubscription) {
this.overlayMenuOpenSubscription.unsubscribe();
+1 -2
View File
@@ -1,4 +1,3 @@
import { MENU_ITEMS } from '@/core/constants';
import { computed, effect, Injectable, signal } from '@angular/core';
import { MenuItem } from 'primeng/api';
import { Subject } from 'rxjs';
@@ -58,7 +57,7 @@ export class LayoutService {
private resetSource = new Subject();
public menuItems = signal<MenuItem[]>(MENU_ITEMS);
public menuItems = signal<MenuItem[]>([]);
menuSource$ = this.menuSource.asObservable();