driver delete button added modal confirmation

dilmurod
Dilmurod 6 days ago
parent 38fa5ae3f6
commit 8ed28f4b58

@ -12,6 +12,7 @@ import {
Input, Input,
Button, Button,
Select, Select,
Modal,
} from "antd"; } from "antd";
import { customerController } from "../../API/LayoutApi/customers"; import { customerController } from "../../API/LayoutApi/customers";
import Notfound from "../../Utils/Notfound"; import Notfound from "../../Utils/Notfound";
@ -54,13 +55,20 @@ const CustomerEdit = () => {
}; };
const ClickDelete = () => { const ClickDelete = () => {
const shouldDelete = window.confirm( Modal.confirm({
"Are you sure, you want to delete this Driver?" title: "Are you sure you want to delete this Driver?",
); okText: "Yes",
if (shouldDelete && id !== undefined) { okType: "danger",
cancelText: "No",
onOk() {
if (id !== undefined) {
customerController.deleteCustomerController(id); customerController.deleteCustomerController(id);
navigate(-1); navigate("/customers/");
refetch();
} }
},
});
}; };
const [activeTab, setActiveTab] = useState("1"); const [activeTab, setActiveTab] = useState("1");

Loading…
Cancel
Save