eleven-solutions-common-website-unique-web 4.0.14 → 4.0.16
Sign up to get free protection for your applications and to get access to all the features.
@@ -80,35 +80,21 @@ const TaxonomyForm = () => {
|
|
80
80
|
setIsSimilarTaxonomyOpen(true);
|
81
81
|
}
|
82
82
|
}, []);
|
83
|
-
// useEffect(() => {
|
84
|
-
// const handleLocationChange = () => {
|
85
|
-
// if (window.location.pathname === "/taxonomy/taxonomyform") {
|
86
|
-
// setIsSimilarTaxonomyOpen(true);
|
87
|
-
// }
|
88
|
-
// else {
|
89
|
-
// setIsSimilarTaxonomyOpen(false);
|
90
|
-
// }
|
91
|
-
// };
|
92
|
-
// handleLocationChange();
|
93
|
-
// window.addEventListener("popstate", handleLocationChange);
|
94
|
-
// return () => {
|
95
|
-
// window.removeEventListener("popstate", handleLocationChange);
|
96
|
-
// };
|
97
|
-
// }, []);
|
98
83
|
const handleSubmit = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
99
84
|
event.preventDefault();
|
100
|
-
|
85
|
+
if (!validateForm())
|
86
|
+
return;
|
101
87
|
try {
|
102
88
|
if (isEditMode) {
|
103
89
|
yield addMultipleTaxonomiesApi(tempTaxonomy);
|
104
90
|
setTempTaxonomy([]);
|
105
|
-
alert("Taxonomies
|
91
|
+
alert("Taxonomies saved successfully");
|
106
92
|
}
|
107
93
|
else {
|
108
94
|
yield addTaxonomyApi(inputType, Number(code), value);
|
109
95
|
alert("Taxonomy added successfully");
|
110
96
|
}
|
111
|
-
window.history.pushState({}, "", "/admin/
|
97
|
+
window.history.pushState({}, "", "/admin/taxinomies");
|
112
98
|
window.dispatchEvent(new PopStateEvent("popstate"));
|
113
99
|
}
|
114
100
|
catch (error) {
|
@@ -191,7 +177,7 @@ const TaxonomyForm = () => {
|
|
191
177
|
alert("Please fill in all required fields: Code, and Value.");
|
192
178
|
return;
|
193
179
|
}
|
194
|
-
const newTaxonomyItem = { type:
|
180
|
+
const newTaxonomyItem = { type: inputType, code: newCode, value: newValue };
|
195
181
|
if (editTempTaxonomyItem) {
|
196
182
|
const updatedTempTaxonomy = tempTaxonomy.map((item) => item === editTempTaxonomyItem ? newTaxonomyItem : item);
|
197
183
|
setTempTaxonomy(updatedTempTaxonomy);
|
package/package.json
CHANGED
@@ -112,39 +112,20 @@ const TaxonomyForm = () => {
|
|
112
112
|
}
|
113
113
|
}, []);
|
114
114
|
|
115
|
-
// useEffect(() => {
|
116
|
-
// const handleLocationChange = () => {
|
117
|
-
// if (window.location.pathname === "/taxonomy/taxonomyform") {
|
118
|
-
// setIsSimilarTaxonomyOpen(true);
|
119
|
-
// }
|
120
|
-
// else {
|
121
|
-
// setIsSimilarTaxonomyOpen(false);
|
122
|
-
// }
|
123
|
-
// };
|
124
|
-
|
125
|
-
// handleLocationChange();
|
126
|
-
|
127
|
-
// window.addEventListener("popstate", handleLocationChange);
|
128
|
-
|
129
|
-
// return () => {
|
130
|
-
// window.removeEventListener("popstate", handleLocationChange);
|
131
|
-
// };
|
132
|
-
// }, []);
|
133
|
-
|
134
115
|
const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement>) => {
|
135
116
|
event.preventDefault();
|
136
|
-
|
117
|
+
if (!validateForm()) return;
|
137
118
|
|
138
119
|
try {
|
139
120
|
if (isEditMode) {
|
140
121
|
await addMultipleTaxonomiesApi(tempTaxonomy);
|
141
122
|
setTempTaxonomy([]);
|
142
|
-
alert("Taxonomies
|
123
|
+
alert("Taxonomies saved successfully");
|
143
124
|
} else {
|
144
125
|
await addTaxonomyApi(inputType, Number(code), value);
|
145
126
|
alert("Taxonomy added successfully");
|
146
127
|
}
|
147
|
-
window.history.pushState({}, "", "/admin/
|
128
|
+
window.history.pushState({}, "", "/admin/taxinomies");
|
148
129
|
window.dispatchEvent(new PopStateEvent("popstate"));
|
149
130
|
} catch (error) {
|
150
131
|
console.error("Error adding/updating Taxonomy:", error);
|
@@ -236,7 +217,7 @@ const TaxonomyForm = () => {
|
|
236
217
|
return;
|
237
218
|
}
|
238
219
|
|
239
|
-
const newTaxonomyItem = { type:
|
220
|
+
const newTaxonomyItem = { type: inputType, code: newCode, value: newValue };
|
240
221
|
|
241
222
|
if (editTempTaxonomyItem) {
|
242
223
|
const updatedTempTaxonomy = tempTaxonomy.map((item) =>
|