import { useCallback } from "react";
import { useTranslation } from "react-i18next";

export default function useConfirmDirtyFormNavigation(isDirty) {
  const { t } = useTranslation();

  return useCallback(() => {
    if (!isDirty) return true;
    return window.confirm(t("general.messages.unsavedchangespopup"));
  }, [isDirty, t]);
}
