Fix prompt, and modal.
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user