feat(simulations): RapportPage avec floutage conditionnel — Sprint 3 étape 15

This commit is contained in:
Hermann_Kitio 2026-04-20 03:46:18 +03:00
parent 1dbca24c35
commit 47d5ec9524
5 changed files with 1484 additions and 7 deletions

View file

@ -0,0 +1,24 @@
/**
* Hook de récupération d'un rapport de correction.
*
* Appelle GET /simulations/:id (cache TanStack Query).
* staleTime Infinity : un rapport ne change jamais après correction.
*
* Règle H : aucune logique métier expose les données brutes.
* FTD-17 : queryKey ['plan'] déjà utilisé dans SimulationPage ['rapport', id] est distinct.
*/
import { useQuery } from '@tanstack/react-query'
import { getReport } from '@/entities/report/api'
import type { Report } from '@/entities/report/types'
export function useRapport(id: string) {
const { data, isLoading, isError, error, refetch } = useQuery<Report, Error>({
queryKey: ['rapport', id],
queryFn: () => getReport(id),
enabled: Boolean(id),
staleTime: Infinity,
})
return { rapport: data, isLoading, isError, error, refetch }
}