frontend phase 15
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import { payoutsApi } from '../apis';
|
||||
import type { PayoutBatchPreview } from '../types';
|
||||
|
||||
/**
|
||||
* The eligibility dry-run for a window — a **mutation**, not an auto-fetching query: it runs only when the
|
||||
* admin explicitly asks to preview (never on mount), and its result (the eligible/skipped breakdown + the
|
||||
* server's holiday-shifted processing date) is read from the mutation's `data`. The client renders it; it
|
||||
* never computes eligibility or the shifted date.
|
||||
*/
|
||||
export function usePreviewPayoutBatch() {
|
||||
return useMutation<PayoutBatchPreview, unknown, { periodStart: string; periodEnd: string }>({
|
||||
mutationFn: ({ periodStart, periodEnd }) => payoutsApi.previewPayoutBatch(periodStart, periodEnd),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user