import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Book } from '../models/book';

@Injectable({
  providedIn: 'root'
})
export class BookService {

  constructor(private http: HttpClient) { }

  back = "http://localhost:8080"

  addBook(b: Book){
    return this.http.post<number>(`${this.back}/books/addBook`, b);
  }

  getAllBooks(){
    return this.http.get<Book[]>(`${this.back}/books/getAllBooks`);
  }

  likeBook(b: Book){
    return this.http.post<number>(`${this.back}/books/likeBook`, b);
  }
}
