Files
workshop-manager/src/hooks/useSessionLive.ts

34 lines
611 B
TypeScript

'use client';
import { useLive, type LiveEvent } from './useLive';
interface UseSessionLiveOptions {
sessionId: string;
currentUserId?: string;
enabled?: boolean;
onEvent?: (event: LiveEvent) => void;
}
interface UseSessionLiveReturn {
isConnected: boolean;
lastEvent: LiveEvent | null;
error: string | null;
}
export function useSessionLive({
sessionId,
currentUserId,
enabled = true,
onEvent,
}: UseSessionLiveOptions): UseSessionLiveReturn {
return useLive({
sessionId,
apiPath: 'sessions',
currentUserId,
enabled,
onEvent,
});
}
export type { LiveEvent };