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

@Component({
  selector: 'app-checked-out',
  templateUrl: './checked-out-page.component.html',
  styleUrls: ['./checked-out-page.component.scss'],
})
export class CheckedOutPageComponent {
  checkedOutItems: PAIADocument[];

  constructor(private readonly libraryAccountService: LibraryAccountService) {}

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