import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { FormsModule } from '@angular/forms';
import { Router, ActivatedRoute, RouterModule } from '@angular/router';
import { Title } from '@angular/platform-browser';
import { CommonModule } from '@angular/common';
import { Resume } from 'app/models/Resume';
import { Authentication } from 'app/services/Authentication';

@Component({
  selector: 'main-resumes',
  templateUrl: './resumes.component.html',
  styleUrls: [ './resumes.component.css' ],
  imports: [ FormsModule, CommonModule, RouterModule ]
})
export class ResumesComponent {

  public ResumePage: Resume[] = [];

  constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication   ) {
    this.title.setTitle("Resumes | BoredCareers");

    this.http.get<Resume[]>("api/resume").subscribe({
      next: data => {
        this.ResumePage = data;
      },
      error: err => {
        console.log("Error fetching resumes: " + err.error);
      }
    });
  };

}