mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-18 13:06:32 +00:00
b77c9be36f
* bump prettier/eslint-plugin * bump nuxt pwa * use typed imports * set vue version to fix layout errors * disable import
23 lines
498 B
TypeScript
23 lines
498 B
TypeScript
import type { UserClient } from "~~/lib/api/user";
|
|
|
|
export function itemsTable(api: UserClient) {
|
|
const { data: items, refresh } = useAsyncData(async () => {
|
|
const { data } = await api.items.getAll({
|
|
page: 1,
|
|
pageSize: 5,
|
|
orderBy: "createdAt",
|
|
});
|
|
return data.items;
|
|
});
|
|
|
|
onServerEvent(ServerEvent.ItemMutation, () => {
|
|
console.log("item mutation");
|
|
refresh();
|
|
});
|
|
|
|
return computed(() => {
|
|
return {
|
|
items: items.value || [],
|
|
};
|
|
});
|
|
}
|