more hacking

This commit is contained in:
Thomas Ruoff
2020-07-26 00:12:51 +02:00
parent 90a9288e84
commit 518b437d14
13 changed files with 166 additions and 54 deletions

View File

@@ -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>
)
}