confirm received
This commit is contained in:
@@ -625,7 +625,12 @@ function RequestsPanel({ rows, isLoading }: { rows: StockRequest[]; isLoading: b
|
|||||||
* this session its button is gone, even before the list refetches.
|
* this session its button is gone, even before the list refetches.
|
||||||
*/
|
*/
|
||||||
const receive = useMutation({
|
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)),
|
onMutate: (requestid) => setDone((set) => new Set(set).add(requestid)),
|
||||||
onSettled: async () => {
|
onSettled: async () => {
|
||||||
await client.invalidateQueries({ queryKey: queryKeys.stock.all });
|
await client.invalidateQueries({ queryKey: queryKeys.stock.all });
|
||||||
|
|||||||
Reference in New Issue
Block a user