Browse Source

+validate doesnt work in build

ilya_shyian 2 years ago
parent
commit
2d6fa4f1d9

+ 3 - 3
build/asset-manifest.json

@@ -1,7 +1,7 @@
 {
   "files": {
     "main.css": "/static/css/main.928beea0.css",
-    "main.js": "/static/js/main.8ae9a3f5.js",
+    "main.js": "/static/js/main.5655e7a1.js",
     "static/js/787.884e199e.chunk.js": "/static/js/787.884e199e.chunk.js",
     "static/media/main-page-image.png": "/static/media/main-page-image.bc655052ce386c031a15.png",
     "static/media/default-avatar-image.png": "/static/media/default-avatar-image.fb653606e5a348e7bc76.png",
@@ -9,11 +9,11 @@
     "static/media/shopping-logo.svg": "/static/media/shopping-logo.423022a24e67b6b6140c294be23af1b0.svg",
     "index.html": "/index.html",
     "main.928beea0.css.map": "/static/css/main.928beea0.css.map",
-    "main.8ae9a3f5.js.map": "/static/js/main.8ae9a3f5.js.map",
+    "main.5655e7a1.js.map": "/static/js/main.5655e7a1.js.map",
     "787.884e199e.chunk.js.map": "/static/js/787.884e199e.chunk.js.map"
   },
   "entrypoints": [
     "static/css/main.928beea0.css",
-    "static/js/main.8ae9a3f5.js"
+    "static/js/main.5655e7a1.js"
   ]
 }

File diff suppressed because it is too large
+ 1 - 1
build/index.html


File diff suppressed because it is too large
+ 3 - 3
build/static/js/main.8ae9a3f5.js


build/static/js/main.8ae9a3f5.js.LICENSE.txt → build/static/js/main.5655e7a1.js.LICENSE.txt


File diff suppressed because it is too large
+ 1 - 1
build/static/js/main.8ae9a3f5.js.map


+ 4 - 1
src/components/admin/AdminGoodPage/GoodForm.js

@@ -58,7 +58,7 @@ export const GoodForm = ({
             amount: 0,
         },
         validationSchema: goodSchema,
-        validateOnSubmit: false,
+        validateOnChange: true,
         onSubmit: () => {
             let goodToSave = {};
             !isNew && good?._id && (goodToSave._id = good._id);
@@ -130,6 +130,9 @@ 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(() => {