eleven-solutions-common-website-unique-web 4.0.16 → 4.0.18
Sign up to get free protection for your applications and to get access to all the features.
@@ -94,8 +94,12 @@ const TaxonomyForm = () => {
|
|
94
94
|
yield addTaxonomyApi(inputType, Number(code), value);
|
95
95
|
alert("Taxonomy added successfully");
|
96
96
|
}
|
97
|
+
// window.history.pushState({}, "", "/admin/taxinomies");
|
98
|
+
// window.dispatchEvent(new PopStateEvent("popstate"));
|
99
|
+
console.log("Navigating to /admin/taxinomies");
|
97
100
|
window.history.pushState({}, "", "/admin/taxinomies");
|
98
101
|
window.dispatchEvent(new PopStateEvent("popstate"));
|
102
|
+
console.log("Navigation event dispatched");
|
99
103
|
}
|
100
104
|
catch (error) {
|
101
105
|
console.error("Error adding/updating Taxonomy:", error);
|
@@ -1,6 +1,8 @@
|
|
1
1
|
export declare const addTaxonomyApi: (type: string, code: number, value: string) => Promise<Axios.AxiosXHR<unknown>>;
|
2
2
|
export declare const fetchTaxonomiessApi: () => Promise<unknown>;
|
3
|
-
export declare const deleteTaxonomyApi: (id: string) => Promise<
|
3
|
+
export declare const deleteTaxonomyApi: (id: string) => Promise<{
|
4
|
+
id: string;
|
5
|
+
}>;
|
4
6
|
export declare const fetchTaxonomyByIdApi: (taxonomyId: string) => Promise<unknown>;
|
5
7
|
export declare const updateTaxonomyApi: (id: string, type: string, code: number, value: string) => Promise<unknown>;
|
6
8
|
export declare const addMultipleTaxonomiesApi: (taxonomies: {
|
@@ -48,21 +48,33 @@ export const fetchTaxonomiessApi = () => __awaiter(void 0, void 0, void 0, funct
|
|
48
48
|
export const deleteTaxonomyApi = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
49
49
|
const token = cookies.get("token");
|
50
50
|
try {
|
51
|
-
const response =
|
51
|
+
// const response = await axios.delete(`${apiUrl}/taxonomy/delete`, {
|
52
|
+
// headers: {
|
53
|
+
// Authorization: `Bearer ${token}`,
|
54
|
+
// },
|
55
|
+
// // data: {
|
56
|
+
// // id,
|
57
|
+
// // },
|
58
|
+
// params: {
|
59
|
+
// id,
|
60
|
+
// },
|
61
|
+
// });
|
62
|
+
// return response.data;
|
63
|
+
const response = yield axios.request({
|
64
|
+
method: "DELETE",
|
65
|
+
url: `${apiUrl}/taxonomy/delete`,
|
52
66
|
headers: {
|
53
67
|
Authorization: `Bearer ${token}`,
|
68
|
+
"Content-Type": "application/json",
|
54
69
|
},
|
55
|
-
|
56
|
-
// id,
|
57
|
-
// },
|
58
|
-
params: {
|
70
|
+
data: {
|
59
71
|
id,
|
60
72
|
},
|
61
73
|
});
|
62
74
|
return response.data;
|
63
75
|
}
|
64
76
|
catch (error) {
|
65
|
-
console.error("Error deleting
|
77
|
+
console.error("Error deleting taxonomy:", error);
|
66
78
|
throw error;
|
67
79
|
}
|
68
80
|
});
|
package/package.json
CHANGED
@@ -125,8 +125,12 @@ const TaxonomyForm = () => {
|
|
125
125
|
await addTaxonomyApi(inputType, Number(code), value);
|
126
126
|
alert("Taxonomy added successfully");
|
127
127
|
}
|
128
|
+
// window.history.pushState({}, "", "/admin/taxinomies");
|
129
|
+
// window.dispatchEvent(new PopStateEvent("popstate"));
|
130
|
+
console.log("Navigating to /admin/taxinomies");
|
128
131
|
window.history.pushState({}, "", "/admin/taxinomies");
|
129
132
|
window.dispatchEvent(new PopStateEvent("popstate"));
|
133
|
+
console.log("Navigation event dispatched");
|
130
134
|
} catch (error) {
|
131
135
|
console.error("Error adding/updating Taxonomy:", error);
|
132
136
|
alert("Failed to add/update Taxonomy");
|
@@ -52,20 +52,32 @@ export const deleteTaxonomyApi = async (id: string) => {
|
|
52
52
|
const token = cookies.get("token");
|
53
53
|
|
54
54
|
try {
|
55
|
-
const response = await axios.delete(`${apiUrl}/taxonomy/delete`, {
|
55
|
+
// const response = await axios.delete(`${apiUrl}/taxonomy/delete`, {
|
56
|
+
// headers: {
|
57
|
+
// Authorization: `Bearer ${token}`,
|
58
|
+
// },
|
59
|
+
// // data: {
|
60
|
+
// // id,
|
61
|
+
// // },
|
62
|
+
// params: {
|
63
|
+
// id,
|
64
|
+
// },
|
65
|
+
// });
|
66
|
+
// return response.data;
|
67
|
+
const response = await axios.request({
|
68
|
+
method: "DELETE",
|
69
|
+
url: `${apiUrl}/taxonomy/delete`,
|
56
70
|
headers: {
|
57
71
|
Authorization: `Bearer ${token}`,
|
72
|
+
"Content-Type": "application/json",
|
58
73
|
},
|
59
|
-
|
60
|
-
// id,
|
61
|
-
// },
|
62
|
-
params: {
|
74
|
+
data: {
|
63
75
|
id,
|
64
76
|
},
|
65
77
|
});
|
66
78
|
return response.data;
|
67
79
|
} catch (error) {
|
68
|
-
console.error("Error deleting
|
80
|
+
console.error("Error deleting taxonomy:", error);
|
69
81
|
throw error;
|
70
82
|
}
|
71
83
|
};
|