mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE): Reset form values on filter modal open and submit
This commit is contained in:
@@ -107,6 +107,7 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
|
||||
|
||||
const handleFilterModalOpen = () => {
|
||||
filterModal.openModal();
|
||||
formik.resetForm({ values: formik.values });
|
||||
};
|
||||
|
||||
// ===== FORMIK SETUP =====
|
||||
@@ -122,7 +123,7 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
|
||||
sort_by: null,
|
||||
},
|
||||
validationSchema: PurchasesPerSupplierFilterSchema,
|
||||
onSubmit: (values) => {
|
||||
onSubmit: (values, { resetForm }) => {
|
||||
setFilterParams({
|
||||
start_date: values.start_date?.toString() || undefined,
|
||||
end_date: values.end_date?.toString() || undefined,
|
||||
@@ -143,6 +144,7 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
|
||||
filterModal.closeModal();
|
||||
setIsSubmitted(true);
|
||||
setCurrentPage(1);
|
||||
resetForm({ values });
|
||||
},
|
||||
onReset: () => {
|
||||
setFilterParams({});
|
||||
|
||||
Reference in New Issue
Block a user