eleven-solutions-common-website-unique-web 9.0.38 → 9.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,7 @@ const Template = () => {
24
24
  });
25
25
  useEffect(() => {
26
26
  fetchTemplatesData();
27
- });
27
+ }, []);
28
28
  const handleNavigation = (event, path) => {
29
29
  event.preventDefault();
30
30
  window.history.pushState({}, "", path);
@@ -2,3 +2,6 @@ export declare const addTemplateApi: (name: string, content: string) => Promise<
2
2
  export declare const fetchTemplatesApi: () => Promise<unknown>;
3
3
  export declare const fetchTemplateByIdApi: (id: string) => Promise<unknown>;
4
4
  export declare const updateTemplateApi: (id: string, name: string, content: string) => Promise<unknown>;
5
+ export declare const deleteTemplateApi: (id: string) => Promise<{
6
+ isDeleted: boolean;
7
+ }>;
@@ -78,3 +78,24 @@ export const updateTemplateApi = (id, name, content) => __awaiter(void 0, void 0
78
78
  throw error;
79
79
  }
80
80
  });
81
+ export const deleteTemplateApi = (id) => __awaiter(void 0, void 0, void 0, function* () {
82
+ const token = cookies.get("token");
83
+ try {
84
+ const response = yield axios.request({
85
+ method: "PATCH",
86
+ url: `${apiUrl}/template/delete/${id}`,
87
+ headers: {
88
+ Authorization: `Bearer ${token}`,
89
+ "Content-Type": "application/json",
90
+ },
91
+ data: {
92
+ isDeleted: true, // Update only the isDeleted property
93
+ },
94
+ });
95
+ return response.data;
96
+ }
97
+ catch (error) {
98
+ console.error("Error updating template:", error);
99
+ throw error;
100
+ }
101
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "9.0.38",
3
+ "version": "9.0.39",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -17,7 +17,7 @@ const Template = () => {
17
17
 
18
18
  useEffect(() => {
19
19
  fetchTemplatesData();
20
- });
20
+ }, []);
21
21
 
22
22
  const handleNavigation = (event: React.MouseEvent, path: string) => {
23
23
  event.preventDefault();
@@ -89,3 +89,25 @@ export const updateTemplateApi = async (
89
89
  throw error;
90
90
  }
91
91
  };
92
+
93
+ export const deleteTemplateApi = async (id: string) => {
94
+ const token = cookies.get("token");
95
+
96
+ try {
97
+ const response = await axios.request({
98
+ method: "PATCH",
99
+ url: `${apiUrl}/template/delete/${id}`,
100
+ headers: {
101
+ Authorization: `Bearer ${token}`,
102
+ "Content-Type": "application/json",
103
+ },
104
+ data: {
105
+ isDeleted: true, // Update only the isDeleted property
106
+ },
107
+ });
108
+ return response.data;
109
+ } catch (error) {
110
+ console.error("Error updating template:", error);
111
+ throw error;
112
+ }
113
+ };