diff --git a/src/screens/Contact/layouts/Ticket.js b/src/screens/Contact/layouts/Ticket.js index 8b6c3d1..ef80aa0 100644 --- a/src/screens/Contact/layouts/Ticket.js +++ b/src/screens/Contact/layouts/Ticket.js @@ -10,6 +10,7 @@ import { import { connect } from "react-redux"; import { userProduct, comment, file, form } from "../../../redux/actions"; import onInput from "../../../utils/onInput"; +import { asyncAwesomeAlert } from "../../../utils/AsyncWrappers"; //components import CustomTextInput from "../../../components/CustomTextInput"; @@ -38,25 +39,23 @@ export const Ticket = ({ }, [status]); useEffect(() => { - if (myProductList.length === 0 && status) { + if (status) { getUserProductList(); } }, []); const send = useCallback(async () => { - if (!ticket?.subject) { - setDialog({ - text: "موضوع پیام خود را وارد کنید.", - type: "alert", - accept: () => {}, - open: true, + if (!ticket?.unit) { + asyncAwesomeAlert("", "واحد مورد نظر خود را وارد نکرده اید.", { + showCancelButton: false, }); - } else if (!ticket?.unit) { - setDialog({ - text: "واحد مورد نظر خود را وارد نکرده اید.", - type: "alert", - accept: () => {}, - open: true, + } else if (!ticket?.subject) { + asyncAwesomeAlert("", "موضوع پیام خود را وارد کنید.", { + showCancelButton: false, + }); + } else if (!ticket?.text) { + asyncAwesomeAlert("", "متن پیام خود را وارد کنید.", { + showCancelButton: false, }); } else { const data = { @@ -71,7 +70,7 @@ export const Ticket = ({ }; await submit(data); } - }, [status]); + }, [status, ticket]); return ( setTicket({ name, value })} value={ticket?.cellphone || ""} regex={(val) => onInput.phonenumber(val)} - maxLength="11" + maxLength={11} /> )} - {/* val} label="موضوع" + textAlign={"right"} /> val} label="متن پیام" multiline={true} + textAlign={"right"} /> - +