Added conditions to check role after connexion and changed guards
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user