diff --git a/src/redux/actions/comment.js b/src/redux/actions/comment.js index d1b2c30..8c12598 100644 --- a/src/redux/actions/comment.js +++ b/src/redux/actions/comment.js @@ -13,6 +13,7 @@ const comment = { (data = {}, data2) => async (dispatch) => { await proxy.post("comment/add", data, { dispatch }); + dispatch({ type : "form/ticket/reset" }); if (data2) await proxy.get("book/info", data2, { dispatch }); }, del: diff --git a/src/redux/reducers/form.js b/src/redux/reducers/form.js index 4350342..76cdfa5 100644 --- a/src/redux/reducers/form.js +++ b/src/redux/reducers/form.js @@ -15,6 +15,8 @@ export default function form(state = initialState, action) { ticket: { ...state.ticket, [data.name]: data.value }, error: null, }; + case "form/ticket/reset": + return { ...state, ticket: {} }; case "form/loading": return { ...state, loading: true }; case "form/error": diff --git a/src/views/Contact/layouts/Ticket.js b/src/views/Contact/layouts/Ticket.js index 5c1d1a2..ac725f8 100644 --- a/src/views/Contact/layouts/Ticket.js +++ b/src/views/Contact/layouts/Ticket.js @@ -60,9 +60,6 @@ export const Ticket = ({ accept: () => {}, open: true, }); - // console.log("mahdi"); - console.log(ticket?.subject); - // console.log("mahdi"); } else if (!ticket?.unit) { setDialog({ text: window.t("واحد مورد نظر خود را وارد نکرده اید."), @@ -83,7 +80,7 @@ export const Ticket = ({ }; await submit(data); } - }, [status]); + }, [status, ticket]); useEffect(() => { window.scrollTo(0, 0); diff --git a/src/views/Products/layouts/Desktop/Main.js b/src/views/Products/layouts/Desktop/Main.js index 2fc794d..d280fb3 100644 --- a/src/views/Products/layouts/Desktop/Main.js +++ b/src/views/Products/layouts/Desktop/Main.js @@ -26,6 +26,7 @@ export const Main = ({ }) => { const [filterLoading, setFilterLoading] = useState(false); const [page, setPage] = useState(1); + console.log(page); const [total, setTotal] = useState(books.length); useEffect(() => { @@ -97,7 +98,6 @@ export const Main = ({ const elements = Items(1); const vods = Items(2); - console.log(elements.length); const lastPage = Math.floor((elements.length - 1) / num) + 1; @@ -248,7 +248,7 @@ export const Main = ({ )} -
+
{elements ?.slice((page - 1) * num, page * num) .map((product, index) => ( @@ -262,11 +262,13 @@ export const Main = ({ /> ))} + {/* pagination */}
{pages.map((e) => (
setPage(e)} > {e}