Browse Source

+validate doesnt work in build

ilya_shyian 2 years ago
parent
commit
95d8b2aaf2
1 changed files with 2 additions and 10 deletions
  1. 2 10
      src/components/admin/AdminGoodPage/GoodForm.js

+ 2 - 10
src/components/admin/AdminGoodPage/GoodForm.js

@@ -130,9 +130,6 @@ export const GoodForm = ({
         formik.setFieldValue("description", good.description || "");
         formik.setFieldValue("amount", good.amount || 0);
         formik.setFieldValue("price", good.price || 0);
-
-        formik.setTouched({ ...formik.touched, ...{ amount: true, description: true, name: true, price: true } });
-        formik.validateForm();
     }, [good.categories, good.name, good.description, good.amount, good.price]);
 
     useEffect(() => {
@@ -234,17 +231,12 @@ export const GoodForm = ({
                         <Button variant="contained" onClick={() => setIsDeleteModalOpen(true)} disabled={formik.isSubmitting} color="error">
                             Видалити
                         </Button>
-                        <Button
-                            variant="contained"
-                            onClick={() => setIsNew(true)}
-                            disabled={!formik.isValid || formik.isSubmitting}
-                            type="submit"
-                        >
+                        <Button variant="contained" onClick={() => setIsNew(true)} disabled={formik.isSubmitting} type="submit">
                             Зберегти як новий
                         </Button>
                     </>
                 )}
-                <Button variant="contained" onClick={() => setIsNew(false)} disabled={!formik.isValid || formik.isSubmitting} type="submit">
+                <Button variant="contained" onClick={() => setIsNew(false)} disabled={formik.isSubmitting} type="submit">
                     Зберегти
                 </Button>
             </Stack>