import { useEffect } from "react";
import { useDispatch, useSelector } from "../store/redux-separate-context";
import { startAlarmsAction } from "../domains/global/actions";
import { selectHasStartedAlarms } from "../domains/global/selectors";
import { serverDefault } from "../utils/server-detection";
export const useAlarms = (shouldUseAlarms) => {
    const hasStartedAlarms = useSelector(selectHasStartedAlarms);
    const dispatch = useDispatch();
    useEffect(() => {
        if (shouldUseAlarms && !hasStartedAlarms) {
            dispatch(startAlarmsAction({
                serverDefault,
            }));
        }
    }, [dispatch, hasStartedAlarms, shouldUseAlarms]);
};
//# sourceMappingURL=use-alarms.js.map