Fix prompt, and modal.

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2023-12-12 15:18:51 -05:00
parent a22c4bdf8c
commit 16d040daf9
2 changed files with 36 additions and 35 deletions

View File

@@ -2,7 +2,6 @@ import React from "react";
import { Form, Space } from "antd";
import { useTranslation } from "react-i18next";
import AlertComponent from "../alert/alert.component";
import {useLocation } from "react-router-dom";
import "./form-fields-changed.styles.scss";
import Prompt from "../../utils/prompt";
@@ -12,7 +11,6 @@ export default function FormsFieldChanged({ form, skipPrompt }) {
const handleReset = () => {
form.resetFields();
};
const loc = useLocation();
//if (!form.isFieldsTouched()) return <></>;
return (
<Form.Item
@@ -28,10 +26,7 @@ export default function FormsFieldChanged({ form, skipPrompt }) {
<Prompt
when={!skipPrompt}
beforeUnload={true}
message={(location) => {
if (loc.pathname === location.pathname) return false;
return t("general.messages.unsavedchangespopup");
}}
message={t("general.messages.unsavedchangespopup")}
/>
<AlertComponent
type="warning"