import { Component } from '@angular/core';
import { Store } from '@ngrx/store';
import { ProfessorService } from '../root-service/professor.service';

@Component({
    selector: 'app-staff',
    templateUrl: './staff.component.html',
    styleUrls: ['./staff.component.css'],
})
export class StaffComponent {
    storeData: any;
    constructor(public store: Store<any>, private professorService: ProfessorService) {
        this.initStore();
        this.loadProfessors();
    }
    async initStore() {
        this.store
            .select((d) => d.index)
            .subscribe((d) => {
                this.storeData = d;
            });
    }
    professors: any[] = [];

    loadProfessors() {
        this.professorService.getAllProfessors().subscribe((result) => {
          console.log(result)
            this.professors = result.content;
        });
    }
}
