- types.ts: ChargeableCharConfig, PagedResult, requests (validFrom/validTo as yyyy-MM-dd strings, UDT-011)
- categories.ts: CHARGEABLE_CHAR_CATEGORIES + CATEGORY_LABELS
- api/: 5 functions (list, getById, create, schedulePriceChange, deactivate) via axiosClient
- hooks/: 5 TanStack Query hooks; mutations invalidate ['chargeableChars','list'] + byId
- SymbolInput.tsx: emoji-blocking input (/\p{Extended_Pictographic}/u), max 4 chars
- ChargeableCharsTable.tsx: shadcn DataTable; medio filter + activeOnly toggle; Vigente/Cerrada badges; formatCivilDate (UDT-011)
- ChargeableCharFormDialog.tsx: dual-mode create/schedulePrice; Zod schema; todayArgentina() min date; 409 inline error
- CopyToAllMediaDialog.tsx: Promise.allSettled over active medios; preview symbol/price/date
- ChargeableCharsPage.tsx: orchestrates table + dialogs + state
- routes.tsx: path/permission constants
- router.tsx: route /admin/tasacion/chargeable-chars registered
- AppSidebar.tsx: nav item "Caracteres Tasables" with Hash icon
- Tests: 22 new RTL/vitest tests (5 test files) — strict TDD RED→GREEN→REFACTOR
15 lines
590 B
TypeScript
15 lines
590 B
TypeScript
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
|
import { schedulePriceChange } from '../api/schedulePriceChange'
|
|
import type { SchedulePriceChangeRequest } from '../types'
|
|
|
|
export function useSchedulePriceChange(id: number) {
|
|
const queryClient = useQueryClient()
|
|
return useMutation({
|
|
mutationFn: (payload: SchedulePriceChangeRequest) => schedulePriceChange(id, payload),
|
|
onSuccess: () => {
|
|
queryClient.invalidateQueries({ queryKey: ['chargeableChars', 'list'] })
|
|
queryClient.invalidateQueries({ queryKey: ['chargeableChars', id] })
|
|
},
|
|
})
|
|
}
|