Fix calendar style

This commit is contained in:
2026-06-14 13:05:53 +02:00
parent 4924982a8a
commit 6ed2a3ae0c
10 changed files with 1005 additions and 31 deletions
+16 -9
View File
@@ -7,7 +7,8 @@ interface UsePlannedDaysResult {
isLoading: boolean
error: string | null
refresh: () => Promise<void>
add: (date: string, childId: string, leaveType: string) => Promise<PlannedLeaveDay>
add: (payload: api.CreatePlannedDayPayload) => Promise<PlannedLeaveDay>
update: (id: string, payload: api.UpdatePlannedDayPayload) => Promise<PlannedLeaveDay>
remove: (id: string) => Promise<void>
}
@@ -32,15 +33,21 @@ export function usePlannedDays(childId?: string): UsePlannedDaysResult {
}, [childId])
const add = useCallback(
async (date: string, childId: string, leaveType: string) => {
const result = await api.createPlannedDay(childId, {
date,
leaveType,
})
async (payload: api.CreatePlannedDayPayload) => {
const result = await api.createPlannedDay(payload)
await fetch()
return result
},
[fetch]
[fetch],
)
const update = useCallback(
async (id: string, payload: api.UpdatePlannedDayPayload) => {
const result = await api.updatePlannedDay(id, payload)
await fetch()
return result
},
[fetch],
)
const remove = useCallback(
@@ -48,12 +55,12 @@ export function usePlannedDays(childId?: string): UsePlannedDaysResult {
await api.deletePlannedDay(id)
await fetch()
},
[fetch]
[fetch],
)
useEffect(() => {
fetch()
}, [fetch])
return { data, isLoading, error, refresh: fetch, add, remove }
return { data, isLoading, error, refresh: fetch, add, update, remove }
}