All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m39s
34 lines
658 B
TypeScript
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,
|
|
});
|
|
}
|