import DeleteButton from '@/books/DeleteButton';
import { getBooks } from '@/books/getBooks';
import { NextPage } from 'next';
import Link from 'next/link';

const BooksPage: NextPage = async () => {
  const books = await getBooks();

  return (
    <div>
      <h1>Bücher</h1>
      <ul>
        {books.map((book) => (
          <li key={book.id}>
            <Link href={`/books/${book.id}`}>{book.title}</Link>
            <DeleteButton book={book} />
          </li>
        ))}
      </ul>
    </div>
  );
};

export default BooksPage;
