import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { catchError } from 'rxjs';
import { Observable } from 'rxjs/internal/Observable';
import { environment } from 'src/environments/environment';
import { Book } from 'src/models/book';


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

  private urlA = "Book/books/title-starting-with-a";
  private urlAA = "Book/books/title-starting-with-aa";

  constructor(private http: HttpClient) {
   }

   public getBooksByTitleA(): Observable<Book[]> {
    return this.http.get<Book[]>(`${environment.apiUrl}/${this.urlA}`);
  }

  public getBooksByTitleAA(): Observable<Book[]> {
    return this.http.get<Book[]>(`${environment.apiUrl}/${this.urlAA}`);
  }


  }