import { Component, inject } from '@angular/core';
import { Book } from '../models/book';
import { BookService } from '../services/book.service';
import { FormsModule } from '@angular/forms';

@Component({
  selector: 'app-admin',
  standalone: true,
  imports: [FormsModule],
  templateUrl: './admin.component.html',
  styleUrl: './admin.component.css'
})
export class AdminComponent {

  book: Book = new Book()

  private bookService = inject(BookService)

  message = ""

  addBook(){
    this.bookService.addBook(this.book).subscribe(data=>{
      if(data>0){
        this.message = "Knjiga dodata";
      }
      else{
        this.message = "Knjiga nije dodata"
      }
    })
  }

}
