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

34 lines
658 B
TypeScript

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