32 lines
734 B
TypeScript
32 lines
734 B
TypeScript
import { h, type FunctionComponent } from 'preact'
|
|
import rek from 'rek'
|
|
import Head from './head.ts'
|
|
import usePromise from '../../shared/hooks/use_promise.ts'
|
|
|
|
import type { Supplier } from '../../../shared/types.ts'
|
|
|
|
const InvoicesPage: FunctionComponent = () => {
|
|
const suppliers = usePromise<Supplier[]>(() => rek('/api/suppliers'))
|
|
|
|
return (
|
|
<section>
|
|
<Head>
|
|
<title> : Invoices</title>
|
|
</Head>
|
|
|
|
<h1>Invoices</h1>
|
|
<ul>
|
|
{suppliers?.map((supplier) => (
|
|
<li>
|
|
<a href={`/invoices/by-supplier/${supplier.id}`}>
|
|
({supplier.id}) {supplier.name}
|
|
</a>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</section>
|
|
)
|
|
}
|
|
|
|
export default InvoicesPage
|