mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
extract non-interactive calendar
This commit is contained in:
23
helpers/useDaysBooked.ts
Normal file
23
helpers/useDaysBooked.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import useSWR from 'swr'
|
||||
|
||||
const fetcher = (path: string) => fetch(path).then((r) => r.json())
|
||||
|
||||
function useDaysBooked() {
|
||||
const { data: daysBooked, error: daysBookedError } = useSWR(
|
||||
'/api/daysbooked',
|
||||
fetcher,
|
||||
{
|
||||
revalidateOnFocus: true,
|
||||
revalidateOnReconnect: true,
|
||||
focusThrottleInterval: 24 * 60 * 60 * 1000,
|
||||
}
|
||||
)
|
||||
|
||||
return {
|
||||
daysBooked,
|
||||
daysBookedError,
|
||||
daysBookedLoading: !daysBooked && !daysBookedError,
|
||||
}
|
||||
}
|
||||
|
||||
export default useDaysBooked
|
||||
Reference in New Issue
Block a user