add cart functionality for tto services
This commit is contained in:
@@ -4,7 +4,6 @@ import { StoreProduct } from '@medusajs/types';
|
||||
|
||||
import { getAvailableTimeSlotsForDisplay } from '~/lib/services/connected-online.service';
|
||||
|
||||
import { ServiceCategory } from '../service-categories';
|
||||
import { BookingContext, Location, TimeSlot } from './booking.context';
|
||||
|
||||
export function useBooking() {
|
||||
@@ -19,10 +18,11 @@ export function useBooking() {
|
||||
|
||||
export const BookingProvider: React.FC<{
|
||||
children: React.ReactElement;
|
||||
category: ServiceCategory;
|
||||
}> = ({ children, category }) => {
|
||||
category: { products: StoreProduct[] };
|
||||
service?: StoreProduct;
|
||||
}> = ({ children, category, service }) => {
|
||||
const [selectedService, setSelectedService] = useState<StoreProduct | null>(
|
||||
category.products[0] || null,
|
||||
(service ?? category?.products?.[0]) || null,
|
||||
);
|
||||
const [selectedLocationId, setSelectedLocationId] = useState<number | null>(
|
||||
null,
|
||||
@@ -32,6 +32,7 @@ export const BookingProvider: React.FC<{
|
||||
const [locations, setLocations] = useState<Location[] | null>(null);
|
||||
const [isLoadingTimeSlots, setIsLoadingTimeSlots] = useState(false);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
let metadataServiceIds = [];
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user