Added conditions to check role after connexion and changed guards

This commit is contained in:
2026-06-01 10:41:50 +01:00
parent cf53e4c8ef
commit 80b4726004
22 changed files with 142 additions and 92 deletions
@@ -9,6 +9,7 @@ import {DelivererForm} from "../deliverer-form/deliverer-form";
import {DeliverersService, GetDelivererDto, GetSupplierDto} from "../../services/api";
import {NzNotificationService} from "ng-zorro-antd/notification";
import {firstValueFrom} from "rxjs";
import {AuthService} from "../../services/auth.service";
@Component({
selector: 'app-deliverer-table',
@@ -28,14 +29,17 @@ import {firstValueFrom} from "rxjs";
export class DelivererTable implements OnInit {
private deliverersService = inject(DeliverersService);
private notificationService = inject(NzNotificationService)
private authService = inject(AuthService);
deliverers = signal<GetDelivererDto[]>([]);
deliverersLoading = signal<boolean>(false);
admin = signal<boolean>(false);
modal = viewChild.required<ModalNav>('modalNav');
async ngOnInit() {
await this.fetchDeliverers();
this.admin.set(this.authService.isAdmin());
}
async fetchDeliverers() {