completed frontend v1

This commit is contained in:
2026-06-13 00:49:16 +03:00
parent 4a5357ee5f
commit 0d98a060e7
35 changed files with 1175 additions and 409 deletions
+23
View File
@@ -0,0 +1,23 @@
import {getInventory, getLowStockInventory} from "#/api/inventory";
import {useQuery} from "@tanstack/react-query";
export const inventoryQueryKeys = {
all: ["inventory"] as const,
list: () => [...inventoryQueryKeys.all, "list"] as const,
lowStock: (threshold?: number) =>
[...inventoryQueryKeys.all, "low-stock", threshold ?? "default"] as const,
};
export function useInventory() {
return useQuery({
queryKey: inventoryQueryKeys.list(),
queryFn: ({signal}) => getInventory(signal),
});
}
export function useLowStockInventory(threshold?: number) {
return useQuery({
queryKey: inventoryQueryKeys.lowStock(threshold),
queryFn: ({signal}) => getLowStockInventory(threshold, signal),
});
}