50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
|
|
import { useState, useCallback } from 'react';
|
||
|
|
import type { BookingSlot, Booking } from './types';
|
||
|
|
|
||
|
|
// Stub hooks - replace with full implementation after migration
|
||
|
|
|
||
|
|
export function useAvailability(_providerId: string): {
|
||
|
|
slots: BookingSlot[];
|
||
|
|
isLoading: boolean;
|
||
|
|
error: string | null;
|
||
|
|
refetch: () => void;
|
||
|
|
} {
|
||
|
|
const [slots] = useState<BookingSlot[]>([]);
|
||
|
|
const [isLoading] = useState(false);
|
||
|
|
const [error] = useState<string | null>(null);
|
||
|
|
|
||
|
|
const refetch = useCallback(() => {
|
||
|
|
console.warn('[STUB] useAvailability.refetch - not implemented');
|
||
|
|
}, []);
|
||
|
|
|
||
|
|
return { slots, isLoading, error, refetch };
|
||
|
|
}
|
||
|
|
|
||
|
|
export function useBooking(_bookingId: string): {
|
||
|
|
booking: Booking | null;
|
||
|
|
isLoading: boolean;
|
||
|
|
error: string | null;
|
||
|
|
} {
|
||
|
|
const [booking] = useState<Booking | null>(null);
|
||
|
|
const [isLoading] = useState(false);
|
||
|
|
const [error] = useState<string | null>(null);
|
||
|
|
|
||
|
|
return { booking, isLoading, error };
|
||
|
|
}
|
||
|
|
|
||
|
|
export function useCreateBooking(): {
|
||
|
|
createBooking: (slotId: string, notes?: string) => Promise<Booking | null>;
|
||
|
|
isLoading: boolean;
|
||
|
|
error: string | null;
|
||
|
|
} {
|
||
|
|
const [isLoading] = useState(false);
|
||
|
|
const [error] = useState<string | null>(null);
|
||
|
|
|
||
|
|
const createBooking = useCallback(async (_slotId: string, _notes?: string): Promise<Booking | null> => {
|
||
|
|
console.warn('[STUB] useCreateBooking.createBooking - not implemented');
|
||
|
|
return null;
|
||
|
|
}, []);
|
||
|
|
|
||
|
|
return { createBooking, isLoading, error };
|
||
|
|
}
|