eleven-solutions-common-website-unique-web 10.0.10 → 10.0.12

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.
@@ -1,7 +1,7 @@
1
- export declare const addUserApi: (name: string, email: string, mobile: string, address: string, roleType: string) => Promise<Axios.AxiosXHR<unknown>>;
2
- export declare const fetchUsersApi: () => Promise<unknown>;
3
- export declare const fetchUserByIdApi: (userId: string) => Promise<unknown>;
4
- export declare const deleteUserApi: (id: string) => Promise<{
1
+ export declare const addUserApi: (url: string, name: string, email: string, mobile: string, address: string, roleType: string) => Promise<Axios.AxiosXHR<unknown>>;
2
+ export declare const fetchUsersApi: (url: string) => Promise<unknown>;
3
+ export declare const fetchUserByIdApi: (url: string, userId: string) => Promise<unknown>;
4
+ export declare const deleteUserApi: (url: string, id: string) => Promise<{
5
5
  id: string;
6
6
  }>;
7
- export declare const updateUserApi: (id: string, name: string, mobile: string, address: string, roleType: string) => Promise<unknown>;
7
+ export declare const updateUserApi: (url: string, id: string, name: string, mobile: string, address: string, roleType: string) => Promise<unknown>;
@@ -11,10 +11,10 @@ import axios from "axios";
11
11
  import Cookies from "universal-cookie";
12
12
  const apiUrl = "http://localhost:5260";
13
13
  const cookies = new Cookies();
14
- export const addUserApi = (name, email, mobile, address, roleType) => __awaiter(void 0, void 0, void 0, function* () {
14
+ export const addUserApi = (url, name, email, mobile, address, roleType) => __awaiter(void 0, void 0, void 0, function* () {
15
15
  const token = cookies.get("token");
16
16
  try {
17
- const response = yield axios.post(`${apiUrl}/login/adduser`, {
17
+ const response = yield axios.post(`${url}/login/adduser`, {
18
18
  Name: name,
19
19
  Email: email,
20
20
  Mobile: mobile,
@@ -32,10 +32,10 @@ export const addUserApi = (name, email, mobile, address, roleType) => __awaiter(
32
32
  throw error;
33
33
  }
34
34
  });
35
- export const fetchUsersApi = () => __awaiter(void 0, void 0, void 0, function* () {
35
+ export const fetchUsersApi = (url) => __awaiter(void 0, void 0, void 0, function* () {
36
36
  const token = cookies.get("token");
37
37
  try {
38
- const response = yield axios.get(`${apiUrl}/login/getuser`, {
38
+ const response = yield axios.get(`${url}/login/getuser`, {
39
39
  headers: {
40
40
  Authorization: `Bearer ${token}`,
41
41
  },
@@ -47,11 +47,11 @@ export const fetchUsersApi = () => __awaiter(void 0, void 0, void 0, function* (
47
47
  return false;
48
48
  }
49
49
  });
50
- export const fetchUserByIdApi = (userId) => __awaiter(void 0, void 0, void 0, function* () {
50
+ export const fetchUserByIdApi = (url, userId) => __awaiter(void 0, void 0, void 0, function* () {
51
51
  const cookies = new Cookies();
52
52
  const token = cookies.get("token");
53
53
  try {
54
- const response = yield axios.get(`${apiUrl}/login/getuserbyid/${userId}`, {
54
+ const response = yield axios.get(`${url}/login/getuserbyid/${userId}`, {
55
55
  headers: {
56
56
  Authorization: `Bearer ${token}`,
57
57
  },
@@ -63,12 +63,12 @@ export const fetchUserByIdApi = (userId) => __awaiter(void 0, void 0, void 0, fu
63
63
  return false;
64
64
  }
65
65
  });
66
- export const deleteUserApi = (id) => __awaiter(void 0, void 0, void 0, function* () {
66
+ export const deleteUserApi = (url, id) => __awaiter(void 0, void 0, void 0, function* () {
67
67
  const token = cookies.get("token");
68
68
  try {
69
69
  const response = yield axios.request({
70
70
  method: "DELETE",
71
- url: `${apiUrl}/login/delete`,
71
+ url: `${url}/login/delete`,
72
72
  headers: {
73
73
  Authorization: `Bearer ${token}`,
74
74
  "Content-Type": "application/json",
@@ -84,10 +84,10 @@ export const deleteUserApi = (id) => __awaiter(void 0, void 0, void 0, function*
84
84
  throw error;
85
85
  }
86
86
  });
87
- export const updateUserApi = (id, name, mobile, address, roleType) => __awaiter(void 0, void 0, void 0, function* () {
87
+ export const updateUserApi = (url, id, name, mobile, address, roleType) => __awaiter(void 0, void 0, void 0, function* () {
88
88
  const token = cookies.get("token");
89
89
  try {
90
- const response = yield axios.post(`${apiUrl}/login/updateuser`, {
90
+ const response = yield axios.post(`${url}/login/updateuser`, {
91
91
  id: id,
92
92
  name: name,
93
93
  Mobile: mobile,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "10.0.10",
3
+ "version": "10.0.12",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -4,11 +4,15 @@ import { useState, useEffect } from "react";
4
4
  import { FaPlus } from "react-icons/fa";
5
5
  import { fetchTaxonomiessApi } from "../api/taxonomy";
6
6
 
7
- const Taxionomies = () => {
7
+ interface TaxionomiesProps {
8
+ url: string;
9
+ }
10
+
11
+ const Taxionomies = ({ url }: TaxionomiesProps) => {
8
12
  const [taxonomy, setTaxonomy] = useState<any[]>([]);
9
13
 
10
14
  const fetchTaxonomiesData = async () => {
11
- const data = await fetchTaxonomiessApi();
15
+ const data = await fetchTaxonomiessApi(url);
12
16
  if (data) {
13
17
  const uniqueTaxonomies = (data as any[]).reduce(
14
18
  (acc: any[], item: any) => {
@@ -153,7 +157,7 @@ const Taxionomies = () => {
153
157
  </thead>
154
158
  <tbody className="bg-white divide-y divide-gray-200 dark:divide-gray-700 dark:bg-gray-900">
155
159
  {paginatedTaxonomies
156
- .filter((taxonomy) => taxonomy.isView) // Exclude taxonomies where isView is true
160
+ .filter((taxonomy) => taxonomy.isView)
157
161
  .map((taxonomy, index) => (
158
162
  <tr key={taxonomy.id || index}>
159
163
  <td className="px-4 py-4 text-sm whitespace-nowrap">
@@ -12,7 +12,11 @@ import {
12
12
  } from "../api/taxonomy";
13
13
  import { FaPlus } from "react-icons/fa";
14
14
 
15
- const TaxonomyForm = () => {
15
+ interface TaxionomyFormProps {
16
+ url: string;
17
+ }
18
+
19
+ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
16
20
  const [type, setType] = useState<string>("");
17
21
  const [inputType, setInputType] = useState<string>("");
18
22
  const [code, setCode] = useState<number | string>("");
@@ -45,7 +49,7 @@ const TaxonomyForm = () => {
45
49
  useEffect(() => {
46
50
  const fetchAllTaxonomies = async () => {
47
51
  try {
48
- const fetchedTaxonomies = await fetchTaxonomiessApi();
52
+ const fetchedTaxonomies = await fetchTaxonomiessApi(url);
49
53
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
50
54
  setAllTaxonomies(fetchedTaxonomies);
51
55
  }
@@ -67,9 +71,9 @@ const TaxonomyForm = () => {
67
71
 
68
72
  const handleDeleteSubTypeClick = async (id: string) => {
69
73
  try {
70
- await deleteTaxonomyApi(id);
74
+ await deleteTaxonomyApi(url, id);
71
75
  alert("Taxonomy deleted successfully");
72
- const fetchedTaxonomies = await fetchTaxonomiessApi();
76
+ const fetchedTaxonomies = await fetchTaxonomiessApi(url);
73
77
 
74
78
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
75
79
  setAllTaxonomies(fetchedTaxonomies);
@@ -110,7 +114,7 @@ const TaxonomyForm = () => {
110
114
  if (id) {
111
115
  const fetchTaxonomyData = async () => {
112
116
  try {
113
- const fetchedTaxonomy = await fetchTaxonomyByIdApi(id);
117
+ const fetchedTaxonomy = await fetchTaxonomyByIdApi(url, id);
114
118
  if (fetchedTaxonomy) {
115
119
  const taxonomy = fetchedTaxonomy as {
116
120
  type: string;
@@ -134,7 +138,7 @@ const TaxonomyForm = () => {
134
138
  useEffect(() => {
135
139
  const handleFetchSimilarTaxonomies = async () => {
136
140
  try {
137
- const response = await fetchTaxonomiessApi();
141
+ const response = await fetchTaxonomiessApi(url);
138
142
  const filteredTaxonomies = (response as { type: string }[]).filter(
139
143
  (taxonomy: { type: string }) => taxonomy.type === type
140
144
  );
@@ -160,11 +164,11 @@ const TaxonomyForm = () => {
160
164
 
161
165
  try {
162
166
  if (isEditMode) {
163
- await addMultipleTaxonomiesApi(tempTaxonomy);
167
+ await addMultipleTaxonomiesApi(url, tempTaxonomy);
164
168
  setTempTaxonomy([]);
165
169
  alert("Taxonomies saved successfully");
166
170
  } else {
167
- await addTaxonomyApi(inputType, Number(code), value);
171
+ await addTaxonomyApi(url, inputType, Number(code), value);
168
172
  alert("Taxonomy added successfully");
169
173
  }
170
174
  window.history.pushState({}, "", "/admin/taxinomies");
@@ -182,10 +186,10 @@ const TaxonomyForm = () => {
182
186
 
183
187
  try {
184
188
  if (isEditMode) {
185
- await updateTaxonomyApi(id, inputType, Number(code), value);
189
+ await updateTaxonomyApi(url, id, inputType, Number(code), value);
186
190
  alert("Taxonomy updated successfully");
187
191
  } else {
188
- await addTaxonomyApi(inputType, Number(code), value);
192
+ await addTaxonomyApi(url, inputType, Number(code), value);
189
193
  alert("Taxonomy added successfully");
190
194
  }
191
195
  window.location.href = "/admin/taxinomies";
@@ -198,7 +202,7 @@ const TaxonomyForm = () => {
198
202
  useEffect(() => {
199
203
  const fetchIsMultiple = async () => {
200
204
  try {
201
- const result = await isMultipleApi(type);
205
+ const result = await isMultipleApi(url, type);
202
206
  setIsMultiple(typeof result === "boolean");
203
207
  } catch (error) {
204
208
  console.error("Error checking if taxonomy is multiple:", error);
@@ -291,13 +295,14 @@ const TaxonomyForm = () => {
291
295
  const handleSubTypeAddClick = async () => {
292
296
  try {
293
297
  await addSubTypeApi(
298
+ url,
294
299
  selectedTaxonomyId,
295
300
  subType,
296
301
  Number(subCode),
297
302
  subValue
298
303
  );
299
304
  alert("SubType added successfully");
300
- const fetchedTaxonomies = await fetchTaxonomiessApi();
305
+ const fetchedTaxonomies = await fetchTaxonomiessApi(url);
301
306
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
302
307
  setAllTaxonomies(fetchedTaxonomies);
303
308
  }
@@ -313,6 +318,7 @@ const TaxonomyForm = () => {
313
318
  const handleSubTypeEditClick = async () => {
314
319
  try {
315
320
  await updateTaxonomyApi(
321
+ url,
316
322
  selectedTaxonomyId,
317
323
  subType,
318
324
  Number(subCode),
@@ -320,7 +326,7 @@ const TaxonomyForm = () => {
320
326
  );
321
327
 
322
328
  alert("SubType edited successfully");
323
- const fetchedTaxonomies = await fetchTaxonomiessApi();
329
+ const fetchedTaxonomies = await fetchTaxonomiessApi(url);
324
330
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
325
331
  setAllTaxonomies(fetchedTaxonomies);
326
332
  }
@@ -351,6 +357,7 @@ const TaxonomyForm = () => {
351
357
  const handleEditTaxClick = async () => {
352
358
  try {
353
359
  await updateTaxonomyApi(
360
+ url,
354
361
  selectedTaxonomyId,
355
362
  type,
356
363
  Number(newCode),
@@ -361,7 +368,7 @@ const TaxonomyForm = () => {
361
368
  console.error("Error updating Taxonomy:", error);
362
369
  }
363
370
  setIsModalOpen(false);
364
- const response = await fetchTaxonomiessApi();
371
+ const response = await fetchTaxonomiessApi(url);
365
372
  const filteredTaxonomies = (response as { type: string }[]).filter(
366
373
  (taxonomy: { type: string }) => taxonomy.type === type
367
374
  );
@@ -374,10 +381,10 @@ const TaxonomyForm = () => {
374
381
  return;
375
382
  }
376
383
  try {
377
- await addMultipleTaxonomiesApi(tempTaxonomy);
384
+ await addMultipleTaxonomiesApi(url, tempTaxonomy);
378
385
  setTempTaxonomy([]);
379
386
  alert("Multiple taxonomies added successfully");
380
- const response = await fetchTaxonomiessApi();
387
+ const response = await fetchTaxonomiessApi(url);
381
388
  const filteredTaxonomies = (response as { type: string }[]).filter(
382
389
  (taxonomy: { type: string }) => taxonomy.type === inputType
383
390
  );
@@ -390,7 +397,7 @@ const TaxonomyForm = () => {
390
397
 
391
398
  const handleDeleteClick = async (id: string) => {
392
399
  try {
393
- await deleteTaxonomyApi(id);
400
+ await deleteTaxonomyApi(url, id);
394
401
  alert("Taxonomy deleted successfully");
395
402
  setSimilarTaxonomies((prevTaxonomies) =>
396
403
  prevTaxonomies.filter((taxonomy) => taxonomy.id !== id)
@@ -688,9 +695,6 @@ const TaxonomyForm = () => {
688
695
  {similarTaxonomies.some(
689
696
  (taxonomy) => taxonomy.isEdit
690
697
  ) && (
691
- // <th className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400">
692
- // Actions
693
- // </th>
694
698
  <th
695
699
  scope="col"
696
700
  className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
@@ -3,11 +3,15 @@ import { useState, useEffect } from "react";
3
3
  import { FaPlus } from "react-icons/fa";
4
4
  import { fetchTemplatesApi, deleteTemplateApi } from "../api/template";
5
5
 
6
- const Template = () => {
6
+ interface TemplateProps {
7
+ url: string;
8
+ }
9
+
10
+ const Template = ({ url }: TemplateProps) => {
7
11
  const [templates, setTemplates] = useState<any[]>([]);
8
12
 
9
13
  const fetchTemplatesData = async () => {
10
- const data = await fetchTemplatesApi();
14
+ const data = await fetchTemplatesApi(url);
11
15
  if (data) {
12
16
  setTemplates(data as any[]);
13
17
  } else {
@@ -65,7 +69,7 @@ const Template = () => {
65
69
 
66
70
  const handleDeleteClick = async (id: string) => {
67
71
  try {
68
- await deleteTemplateApi(id);
72
+ await deleteTemplateApi(url, id);
69
73
  alert("Template deleted successfully");
70
74
 
71
75
  fetchTemplatesData();
@@ -7,7 +7,11 @@ import {
7
7
 
8
8
  import Editor from "./Editor";
9
9
 
10
- const TemplateForm = () => {
10
+ interface TemplateFormProps {
11
+ url: string;
12
+ }
13
+
14
+ const TemplateForm = ({ url }: TemplateFormProps) => {
11
15
  const [name, setName] = useState("");
12
16
  const [content, setContent] = useState("");
13
17
  const placeholder = "";
@@ -38,7 +42,7 @@ const TemplateForm = () => {
38
42
  if (id) {
39
43
  const fetchTemplateData = async () => {
40
44
  try {
41
- const fetchedUser = await fetchTemplateByIdApi(id);
45
+ const fetchedUser = await fetchTemplateByIdApi(url, id);
42
46
  if (fetchedUser) {
43
47
  const user = fetchedUser as {
44
48
  name: string;
@@ -62,10 +66,10 @@ const TemplateForm = () => {
62
66
 
63
67
  try {
64
68
  if (isEditMode) {
65
- await updateTemplateApi(id, name, content);
69
+ await updateTemplateApi(url, id, name, content);
66
70
  alert("Template updated successfully");
67
71
  } else {
68
- await addTemplateApi(name, content);
72
+ await addTemplateApi(url, name, content);
69
73
  alert("Template added successfully");
70
74
  }
71
75
  window.history.pushState({}, "", "/admin/template");
@@ -3,7 +3,11 @@ import { useState, useEffect } from "react";
3
3
 
4
4
  import { addUserApi, updateUserApi, fetchUserByIdApi } from "../api/user";
5
5
 
6
- const UserForm = () => {
6
+ interface UserFormProps {
7
+ url: string;
8
+ }
9
+
10
+ const UserForm = ({ url }: UserFormProps) => {
7
11
  const [userName, setUserName] = useState("");
8
12
  const [email, setEmail] = useState("");
9
13
  const [mobile, setMobile] = useState("");
@@ -29,7 +33,7 @@ const UserForm = () => {
29
33
  if (id) {
30
34
  const fetchUserData = async () => {
31
35
  try {
32
- const fetchedUser = await fetchUserByIdApi(id);
36
+ const fetchedUser = await fetchUserByIdApi(url, id);
33
37
  if (fetchedUser) {
34
38
  const user = fetchedUser as {
35
39
  name: string;
@@ -59,10 +63,10 @@ const UserForm = () => {
59
63
 
60
64
  try {
61
65
  if (isEditMode) {
62
- await updateUserApi(id, userName, mobile, address, roleType);
66
+ await updateUserApi(url, id, userName, mobile, address, roleType);
63
67
  alert("User updated successfully");
64
68
  } else {
65
- await addUserApi(userName, email, mobile, address, roleType);
69
+ await addUserApi(url, userName, email, mobile, address, roleType);
66
70
  alert("User added successfully");
67
71
  }
68
72
  // window.location.href = "/admin/users";
@@ -5,11 +5,15 @@ import { FaPlus } from "react-icons/fa";
5
5
 
6
6
  import { fetchUsersApi, deleteUserApi } from "../api/user";
7
7
 
8
- function Users() {
8
+ interface UsersProps {
9
+ url: string;
10
+ }
11
+
12
+ const Users = ({ url }: UsersProps) => {
9
13
  const [users, setUsers] = useState<any[]>([]);
10
14
 
11
15
  const fetchUsersData = async () => {
12
- const data = await fetchUsersApi();
16
+ const data = await fetchUsersApi(url);
13
17
  if (data) {
14
18
  setUsers(data as any[]);
15
19
  } else {
@@ -55,7 +59,7 @@ function Users() {
55
59
 
56
60
  const handleDeleteClick = async (id: string) => {
57
61
  try {
58
- await deleteUserApi(id);
62
+ await deleteUserApi(url, id);
59
63
  alert("User deleted successfully");
60
64
 
61
65
  fetchUsersData();
@@ -227,6 +231,7 @@ function Users() {
227
231
  />
228
232
  </svg>
229
233
  </button>
234
+ {/* </a> */}
230
235
  </div>
231
236
  </td>
232
237
  <td className="px-4 py-4 text-sm font-medium text-gray-700 whitespace-nowrap">
@@ -336,6 +341,6 @@ function Users() {
336
341
  </div>
337
342
  </div>
338
343
  );
339
- }
344
+ };
340
345
 
341
346
  export default Users;
@@ -4,6 +4,7 @@ const apiUrl = "http://localhost:5260";
4
4
  const cookies = new Cookies();
5
5
 
6
6
  export const addTaxonomyApi = async (
7
+ url: string,
7
8
  type: string,
8
9
  code: number,
9
10
  value: string
@@ -12,7 +13,7 @@ export const addTaxonomyApi = async (
12
13
 
13
14
  try {
14
15
  const response = await axios.post(
15
- `${apiUrl}/taxonomy/add`,
16
+ `${url}/taxonomy/add`,
16
17
  {
17
18
  Type: type,
18
19
  Code: code,
@@ -32,11 +33,11 @@ export const addTaxonomyApi = async (
32
33
  }
33
34
  };
34
35
 
35
- export const fetchTaxonomiessApi = async () => {
36
+ export const fetchTaxonomiessApi = async (url: string) => {
36
37
  const token = cookies.get("authToken");
37
38
 
38
39
  try {
39
- const response = await axios.get(`${apiUrl}/taxonomy/gettaxonomy`, {
40
+ const response = await axios.get(`${url}/taxonomy/gettaxonomy`, {
40
41
  headers: {
41
42
  Authorization: `Bearer ${token}`,
42
43
  },
@@ -48,13 +49,13 @@ export const fetchTaxonomiessApi = async () => {
48
49
  }
49
50
  };
50
51
 
51
- export const deleteTaxonomyApi = async (id: string) => {
52
+ export const deleteTaxonomyApi = async (url: string, id: string) => {
52
53
  const token = cookies.get("authToken");
53
54
 
54
55
  try {
55
56
  const response = await axios.request({
56
57
  method: "DELETE",
57
- url: `${apiUrl}/taxonomy/delete`,
58
+ url: `${url}/taxonomy/delete`,
58
59
  headers: {
59
60
  Authorization: `Bearer ${token}`,
60
61
  "Content-Type": "application/json",
@@ -70,13 +71,13 @@ export const deleteTaxonomyApi = async (id: string) => {
70
71
  }
71
72
  };
72
73
 
73
- export const fetchTaxonomyByIdApi = async (taxonomyId: string) => {
74
+ export const fetchTaxonomyByIdApi = async (url: string, taxonomyId: string) => {
74
75
  const cookies = new Cookies();
75
76
  const token = cookies.get("authToken");
76
77
 
77
78
  try {
78
79
  const response = await axios.get(
79
- `${apiUrl}/taxonomy/gettaxonomybyid/${taxonomyId}`,
80
+ `${url}/taxonomy/gettaxonomybyid/${taxonomyId}`,
80
81
  {
81
82
  headers: {
82
83
  Authorization: `Bearer ${token}`,
@@ -92,6 +93,7 @@ export const fetchTaxonomyByIdApi = async (taxonomyId: string) => {
92
93
  };
93
94
 
94
95
  export const updateTaxonomyApi = async (
96
+ url: string,
95
97
  id: string,
96
98
  type: string,
97
99
  code: number,
@@ -101,7 +103,7 @@ export const updateTaxonomyApi = async (
101
103
 
102
104
  try {
103
105
  const response = await axios.post(
104
- `${apiUrl}/taxonomy/updatetaxonomy`,
106
+ `${url}/taxonomy/updatetaxonomy`,
105
107
  {
106
108
  Id: id,
107
109
  Type: type,
@@ -121,13 +123,14 @@ export const updateTaxonomyApi = async (
121
123
  };
122
124
 
123
125
  export const addMultipleTaxonomiesApi = async (
126
+ url: string,
124
127
  taxonomies: { type: string; code: number; value: string }[]
125
128
  ) => {
126
129
  const token = cookies.get("authToken");
127
130
 
128
131
  try {
129
132
  const response = await axios.post(
130
- `${apiUrl}/taxonomy/addmultipletaxonomies`,
133
+ `${url}/taxonomy/addmultipletaxonomies`,
131
134
  taxonomies,
132
135
  {
133
136
  headers: {
@@ -146,12 +149,12 @@ export const addMultipleTaxonomiesApi = async (
146
149
  }
147
150
  };
148
151
 
149
- export const isMultipleApi = async (type: string) => {
152
+ export const isMultipleApi = async (url: string, type: string) => {
150
153
  const token = cookies.get("authToken");
151
154
 
152
155
  try {
153
156
  const response = await axios.get(
154
- `${apiUrl}/taxonomy/IsTaxonomyMultipleByType/${type}`,
157
+ `${url}/taxonomy/IsTaxonomyMultipleByType/${type}`,
155
158
  {
156
159
  headers: {
157
160
  Authorization: `Bearer ${token}`,
@@ -166,6 +169,7 @@ export const isMultipleApi = async (type: string) => {
166
169
  };
167
170
 
168
171
  export const addSubTypeApi = async (
172
+ url: string,
169
173
  parentid: string,
170
174
  type: string,
171
175
  code: number,
@@ -175,7 +179,7 @@ export const addSubTypeApi = async (
175
179
 
176
180
  try {
177
181
  const response = await axios.post(
178
- `${apiUrl}/taxonomy/addsubtype`,
182
+ `${url}/taxonomy/addsubtype`,
179
183
  {
180
184
  ParentId: parentid,
181
185
  Type: type,
@@ -3,12 +3,16 @@ import Cookies from "universal-cookie";
3
3
  const apiUrl = "http://localhost:5260";
4
4
  const cookies = new Cookies();
5
5
 
6
- export const addTemplateApi = async (name: string, content: string) => {
6
+ export const addTemplateApi = async (
7
+ url: string,
8
+ name: string,
9
+ content: string
10
+ ) => {
7
11
  const token = cookies.get("authToken");
8
12
 
9
13
  try {
10
14
  const response = await axios.post(
11
- `${apiUrl}/template/add`,
15
+ `${url}/template/add`,
12
16
  {
13
17
  Name: name,
14
18
  Content: content,
@@ -26,11 +30,11 @@ export const addTemplateApi = async (name: string, content: string) => {
26
30
  }
27
31
  };
28
32
 
29
- export const fetchTemplatesApi = async () => {
33
+ export const fetchTemplatesApi = async (url: string) => {
30
34
  const token = cookies.get("authToken");
31
35
 
32
36
  try {
33
- const response = await axios.get(`${apiUrl}/template/gettemplate`, {
37
+ const response = await axios.get(`${url}/template/gettemplate`, {
34
38
  headers: {
35
39
  Authorization: `Bearer ${token}`,
36
40
  },
@@ -42,19 +46,16 @@ export const fetchTemplatesApi = async () => {
42
46
  }
43
47
  };
44
48
 
45
- export const fetchTemplateByIdApi = async (id: string) => {
49
+ export const fetchTemplateByIdApi = async (url: string, id: string) => {
46
50
  const cookies = new Cookies();
47
51
  const token = cookies.get("authToken");
48
52
 
49
53
  try {
50
- const response = await axios.get(
51
- `${apiUrl}/template/gettemplatebyid/${id}`,
52
- {
53
- headers: {
54
- Authorization: `Bearer ${token}`,
55
- },
56
- }
57
- );
54
+ const response = await axios.get(`${url}/template/gettemplatebyid/${id}`, {
55
+ headers: {
56
+ Authorization: `Bearer ${token}`,
57
+ },
58
+ });
58
59
 
59
60
  return response.data;
60
61
  } catch (error) {
@@ -64,6 +65,7 @@ export const fetchTemplateByIdApi = async (id: string) => {
64
65
  };
65
66
 
66
67
  export const updateTemplateApi = async (
68
+ url: string,
67
69
  id: string,
68
70
  name: string,
69
71
  content: string
@@ -72,7 +74,7 @@ export const updateTemplateApi = async (
72
74
 
73
75
  try {
74
76
  const response = await axios.post(
75
- `${apiUrl}/template/updatetemplate`,
77
+ `${url}/template/updatetemplate`,
76
78
  {
77
79
  id: id,
78
80
  name: name,
@@ -90,12 +92,12 @@ export const updateTemplateApi = async (
90
92
  }
91
93
  };
92
94
 
93
- export const deleteTemplateApi = async (id: string) => {
95
+ export const deleteTemplateApi = async (url: string, id: string) => {
94
96
  const token = cookies.get("authToken");
95
97
 
96
98
  try {
97
99
  const response = await axios.post(
98
- `${apiUrl}/template/deletetemplate`,
100
+ `${url}/template/deletetemplate`,
99
101
  {
100
102
  id: id,
101
103
  },