mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 14:37:13 +01:00
more hacking
This commit is contained in:
@@ -13,8 +13,8 @@ const fetcher = (path) => fetch(path).then((r) => r.json())
|
||||
|
||||
export default function DateSelect() {
|
||||
const { state, dispatch } = useContext(WizardContext)
|
||||
const { data: bookedOn, error: fetchBookedOnError } = useSWR(
|
||||
'/api/booked',
|
||||
const { data: daysBooked, error: fetchBookedOnError } = useSWR(
|
||||
'/api/daysbooked',
|
||||
fetcher
|
||||
)
|
||||
|
||||
@@ -29,18 +29,15 @@ export default function DateSelect() {
|
||||
|
||||
function isDayBlocked(momentDay) {
|
||||
return (
|
||||
bookedOn && bookedOn.some((rawDay) => momentDay.isSame(rawDay, 'day'))
|
||||
daysBooked && daysBooked.some((rawDay) => momentDay.isSame(rawDay, 'day'))
|
||||
)
|
||||
}
|
||||
|
||||
if (!bookedOn) {
|
||||
return <div>Lade Buchungen...</div>
|
||||
}
|
||||
|
||||
if (fetchBookedOnError) {
|
||||
return (
|
||||
<div>
|
||||
Entschuldige, aber die Buchungszeiten konnten nicht geladen werden
|
||||
Entschuldige, aber die Buchungszeiten konnten nicht geladen werden.
|
||||
Versuchen Sie es später nochmals.
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user