import { useEffect } from "react";
import { dispatch, useCurrentRound } from "../../../domain/gameStore";

const useIsFinished = () => {
  const finished = useCurrentRound() === null;
  useEffect(() => {
    if (finished) {
      dispatch.goToSummary();
    }
  }, [finished]);
  return finished;
};

export default useIsFinished;
