NGU-Web/src/lib/useHistory.ts
Zaldimmar e4a9c96f7e Finish the audit leftovers
- One mediaUrl in media.ts instead of 12 identical aliases and a
  kind map; orgPath builds on hrefs.ts's orgHref
- One Logo component (hides itself or shows a fallback when the file
  is missing) for event cards, org lists and chapter marks
- useHistory is a thin wrapper over useRecord
- adminSchema.ts split into adminSchema/, one file per entity plus
  shared.ts; the registry is unchanged (checked by loading both)
- JS smooth scrolls respect reduced motion (lib/motion.ts)
- Content-Security-Policy in Report-Only, with /api/csp-report logging
  what it would block

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 22:49:07 -05:00

17 lines
653 B
TypeScript

/**
* Loads the history timeline from `GET /api/history`, through
* useRecord (its `items`), so it shares the cache, the reload that
* invalidates first, and the error handling with every detail page.
*
* The API also sends `undated`, the number of published entries it
* left out for having no date. Nothing shows it; read it here if the
* admin ever wants a warning.
*/
import type { TimelineItem } from './timeline.ts'
import { useRecord } from './useRecord.ts'
export function useHistory() {
const { data, loading, error, reload } = useRecord<TimelineItem[]>('/history', 'items')
return { items: data ?? [], loading, error, reload }
}