This commit is contained in:
Danel Kungla
2025-09-24 16:54:36 +03:00
parent 41593be44a
commit c7298d2b7e
2 changed files with 7 additions and 12 deletions

View File

@@ -33,18 +33,14 @@ export const BookingProvider: React.FC<{
const [isLoadingTimeSlots, setIsLoadingTimeSlots] = useState(false);
useEffect(() => {
let metadataServiceIds = [];
try {
metadataServiceIds = JSON.parse(
selectedService?.metadata?.serviceIds as string,
);
} catch (e) {
console.error(e);
const metadataServiceIds = selectedService?.metadata?.serviceIds as string;
if (metadataServiceIds) {
const json = JSON.parse(metadataServiceIds);
if (Array.isArray(json)) {
updateTimeSlots(json);
}
}
if (metadataServiceIds.length) {
updateTimeSlots(metadataServiceIds);
}
}, [selectedService?.metadata?.serviceIds, selectedLocationId]);
}, [selectedService, selectedLocationId]);
const updateTimeSlots = async (serviceIds: number[]) => {
setIsLoadingTimeSlots(true);