confirm received

This commit is contained in:
2026-09-03 14:42:56 +05:30
parent e1bb0a5307
commit 350eb8f29c

View File

@@ -625,7 +625,12 @@ function RequestsPanel({ rows, isLoading }: { rows: StockRequest[]; isLoading: b
* this session its button is gone, even before the list refetches.
*/
const receive = useMutation({
mutationFn: (requestid: number) => stockApi.approve(requestid),
// `confirmArrival`, not `approve`. They were the same call until the ladder
// grew an Approved step between asking and arriving; `approve` now means
// "the admin agreed to send it" and moves no stock at all. This button is
// the shop saying the goods are HERE, which is the transition the backend
// credits the ledger off.
mutationFn: (requestid: number) => stockApi.confirmArrival(requestid),
onMutate: (requestid) => setDone((set) => new Set(set).add(requestid)),
onSettled: async () => {
await client.invalidateQueries({ queryKey: queryKeys.stock.all });