import { Component, OnInit } from '@angular/core';
import { CvService } from '../services/cv.service';
import { BaseComponent } from '../base/base.component';
import { IBlog } from './blog.model';
import { environment } from 'src/environments/environment';

@Component({
  selector: 'app-blog',
  templateUrl: './blog.component.html',
  styleUrl: './blog.component.scss'
})
export class BlogComponent extends BaseComponent<IBlog> implements OnInit{
  blogUrl!: string;
  constructor(svc: CvService){
    super(svc);
  }

  ngOnInit(): void {
    this.getBlog();
  }

  getBlog(){
    this.svc.getBlog(this.candidateId).subscribe((response: IBlog) => {
      this.svc.blog = this.svc.blog ?? response;
      this.assignData(response);
      this.blogUrl = this.svc.blog.blogUrl;
    });
  }
}
