eleven-solutions-common-website-unique-web 4.0.15 → 4.0.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -80,36 +80,26 @@ 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
- // if (!validateForm()) return;
85
+ if (!validateForm())
86
+ return;
101
87
  try {
102
88
  if (isEditMode) {
103
89
  yield addMultipleTaxonomiesApi(tempTaxonomy);
104
90
  setTempTaxonomy([]);
105
- alert("Taxonomies added successfully");
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
  }
97
+ // window.history.pushState({}, "", "/admin/taxinomies");
98
+ // window.dispatchEvent(new PopStateEvent("popstate"));
99
+ console.log("Navigating to /admin/taxinomies");
111
100
  window.history.pushState({}, "", "/admin/taxinomies");
112
101
  window.dispatchEvent(new PopStateEvent("popstate"));
102
+ console.log("Navigation event dispatched");
113
103
  }
114
104
  catch (error) {
115
105
  console.error("Error adding/updating Taxonomy:", error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "4.0.15",
3
+ "version": "4.0.17",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -112,40 +112,25 @@ 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
- // if (!validateForm()) return;
117
+ if (!validateForm()) return;
137
118
 
138
119
  try {
139
120
  if (isEditMode) {
140
121
  await addMultipleTaxonomiesApi(tempTaxonomy);
141
122
  setTempTaxonomy([]);
142
- alert("Taxonomies added successfully");
123
+ alert("Taxonomies saved successfully");
143
124
  } else {
144
125
  await addTaxonomyApi(inputType, Number(code), value);
145
126
  alert("Taxonomy added successfully");
146
127
  }
128
+ // window.history.pushState({}, "", "/admin/taxinomies");
129
+ // window.dispatchEvent(new PopStateEvent("popstate"));
130
+ console.log("Navigating to /admin/taxinomies");
147
131
  window.history.pushState({}, "", "/admin/taxinomies");
148
132
  window.dispatchEvent(new PopStateEvent("popstate"));
133
+ console.log("Navigation event dispatched");
149
134
  } catch (error) {
150
135
  console.error("Error adding/updating Taxonomy:", error);
151
136
  alert("Failed to add/update Taxonomy");