Phase 1: Fix TypeScript compilation — add missing API functions and fix hook signatures

- Add 8 missing API client functions (getBreakPeriods, createBreakPeriod, deleteBreakPeriod, getTips, getParentalLeave, getPlannedDays, createPlannedDay, deletePlannedDay)
- Fix useAnalytics to accept optional childId parameter
- Fix ApiError strict optional properties handling
- Export HeaderProps from Header component
- Update hook tests to use correct data structures and optional parameters

npx tsc --noEmit now passes with zero errors.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-06-01 17:47:17 +02:00
parent 53d157535a
commit fbb7a04580
15 changed files with 1092 additions and 62 deletions
+4 -4
View File
@@ -9,17 +9,17 @@ interface UseAnalyticsResult {
refresh: () => Promise<void>
}
export function useAnalytics(workspaceId: string | null): UseAnalyticsResult {
export function useAnalytics(workspaceId: string | null, childId?: string): UseAnalyticsResult {
const [data, setData] = useState<WorkspaceOverview | null>(null)
const [isLoading, setIsLoading] = useState(false)
const [error, setError] = useState<string | null>(null)
const fetch = useCallback(async () => {
if (!workspaceId) return
if (!workspaceId || !childId) return
setIsLoading(true)
setError(null)
try {
const response = await api.getWorkspaceOverview(workspaceId)
const response = await api.getWorkspaceOverview(workspaceId, childId)
setData(response)
} catch (err) {
setError(err instanceof Error ? err.message : 'Failed to fetch analytics')
@@ -27,7 +27,7 @@ export function useAnalytics(workspaceId: string | null): UseAnalyticsResult {
} finally {
setIsLoading(false)
}
}, [workspaceId])
}, [workspaceId, childId])
useEffect(() => {
fetch()