import {Component} from '@angular/core';
import {LibraryAccountService} from '../library-account.service';
import {PAIADocument} from '../../types';

@Component({
  selector: 'app-holds-and-reservations',
  templateUrl: './holds-and-reservations-page.component.html',
  styleUrls: ['./holds-and-reservations-page.component.scss'],
})
export class HoldsAndReservationsPageComponent {
  holds: PAIADocument[];

  constructor(private readonly libraryAccountService: LibraryAccountService) {}

  async ionViewWillEnter(): Promise<void> {
    try {
      this.holds = await this.libraryAccountService.getHoldsAndReservations();
    } catch {
      // TODO: error handling
    }
  }
}
