feat(drill): ProviderDrawer with Overview tab + DrillDrawerHeader shell
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { api } from "@/lib/api";
|
||||
import type { Provider } from "@/types";
|
||||
|
||||
/**
|
||||
* Per-provider detail drawer query (SP21 Task 2.2).
|
||||
*
|
||||
* Drives ``GET /api/config/providers/{npi}`` via ``api.getProvider``.
|
||||
* The endpoint (added in Task 1.6) returns the full ``Provider`` shape
|
||||
* with ``recent_claims`` and ``recent_activity`` arrays populated when
|
||||
* the backend can serve them — Phase 3 will render those; Phase 2 only
|
||||
* consumes the base fields.
|
||||
*
|
||||
* `npi === null` (drawer closed) disables the query so no fetch is
|
||||
* issued. ``staleTime`` is 60 s — provider directory rows change
|
||||
* infrequently, but we still want the drawer to refresh when a user
|
||||
* reopens it across a long session.
|
||||
*/
|
||||
export function useProviderDetail(npi: string | null) {
|
||||
return useQuery<Provider>({
|
||||
queryKey: ["provider-detail", npi],
|
||||
queryFn: () => api.getProvider(npi as string),
|
||||
enabled: npi !== null,
|
||||
staleTime: 60 * 1000,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user