forked from mirrors/homebox
6a8a25e3f8
* wip: charts.js experimental work * update lock file * wip: frontend redesign * wip: more UI fixes for consistency across themes * cleanup * improve UI log * style updates * fix lint errors
42 lines
788 B
TypeScript
42 lines
788 B
TypeScript
import { TableHeader } from "~~/components/global/Table.types";
|
|
|
|
import { UserClient } from "~~/lib/api/user";
|
|
|
|
export function itemsTable(api: UserClient) {
|
|
const { data: items } = useAsyncData(async () => {
|
|
const { data } = await api.items.getAll({
|
|
page: 1,
|
|
pageSize: 5,
|
|
});
|
|
return data.items;
|
|
});
|
|
|
|
const headers = [
|
|
{
|
|
text: "Name",
|
|
sortable: true,
|
|
value: "name",
|
|
},
|
|
{
|
|
text: "Location",
|
|
value: "location.name",
|
|
},
|
|
{
|
|
text: "Warranty",
|
|
value: "warranty",
|
|
align: "center",
|
|
},
|
|
{
|
|
text: "Price",
|
|
value: "purchasePrice",
|
|
align: "center",
|
|
},
|
|
] as TableHeader[];
|
|
|
|
return computed(() => {
|
|
return {
|
|
headers,
|
|
items: items.value || [],
|
|
};
|
|
});
|
|
}
|