eleven-solutions-common-website-unique-web 10.0.5 → 10.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +1,4 @@
1
- declare const Taxionomies: () => import("react/jsx-runtime").JSX.Element;
1
+ declare const Taxionomies: ({ url }: {
2
+ url: string;
3
+ }) => import("react/jsx-runtime").JSX.Element;
2
4
  export default Taxionomies;
@@ -11,10 +11,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  import { useState, useEffect } from "react";
12
12
  import { FaPlus } from "react-icons/fa";
13
13
  import { fetchTaxonomiessApi } from "../api/taxonomy";
14
- const Taxionomies = () => {
14
+ const Taxionomies = ({ url }) => {
15
15
  const [taxonomy, setTaxonomy] = useState([]);
16
16
  const fetchTaxonomiesData = () => __awaiter(void 0, void 0, void 0, function* () {
17
- const data = yield fetchTaxonomiessApi();
17
+ const data = yield fetchTaxonomiessApi(url);
18
18
  if (data) {
19
19
  const uniqueTaxonomies = data.reduce((acc, item) => {
20
20
  if (!item.parentId &&
@@ -1,2 +1,4 @@
1
- declare const TaxonomyForm: () => import("react/jsx-runtime").JSX.Element;
1
+ declare const TaxonomyForm: ({ url }: {
2
+ url: string;
3
+ }) => import("react/jsx-runtime").JSX.Element;
2
4
  export default TaxonomyForm;
@@ -12,7 +12,7 @@ import React from "react";
12
12
  import { useState, useEffect } from "react";
13
13
  import { addTaxonomyApi, fetchTaxonomyByIdApi, updateTaxonomyApi, fetchTaxonomiessApi, addMultipleTaxonomiesApi, deleteTaxonomyApi, isMultipleApi, addSubTypeApi, } from "../api/taxonomy";
14
14
  import { FaPlus } from "react-icons/fa";
15
- const TaxonomyForm = () => {
15
+ const TaxonomyForm = ({ url }) => {
16
16
  const [type, setType] = useState("");
17
17
  const [inputType, setInputType] = useState("");
18
18
  const [code, setCode] = useState("");
@@ -36,7 +36,7 @@ const TaxonomyForm = () => {
36
36
  useEffect(() => {
37
37
  const fetchAllTaxonomies = () => __awaiter(void 0, void 0, void 0, function* () {
38
38
  try {
39
- const fetchedTaxonomies = yield fetchTaxonomiessApi();
39
+ const fetchedTaxonomies = yield fetchTaxonomiessApi(url);
40
40
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
41
41
  setAllTaxonomies(fetchedTaxonomies);
42
42
  }
@@ -54,9 +54,9 @@ const TaxonomyForm = () => {
54
54
  };
55
55
  const handleDeleteSubTypeClick = (id) => __awaiter(void 0, void 0, void 0, function* () {
56
56
  try {
57
- yield deleteTaxonomyApi(id);
57
+ yield deleteTaxonomyApi(url, id);
58
58
  alert("Taxonomy deleted successfully");
59
- const fetchedTaxonomies = yield fetchTaxonomiessApi();
59
+ const fetchedTaxonomies = yield fetchTaxonomiessApi(url);
60
60
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
61
61
  setAllTaxonomies(fetchedTaxonomies);
62
62
  }
@@ -81,7 +81,7 @@ const TaxonomyForm = () => {
81
81
  if (id) {
82
82
  const fetchTaxonomyData = () => __awaiter(void 0, void 0, void 0, function* () {
83
83
  try {
84
- const fetchedTaxonomy = yield fetchTaxonomyByIdApi(id);
84
+ const fetchedTaxonomy = yield fetchTaxonomyByIdApi(url, id);
85
85
  if (fetchedTaxonomy) {
86
86
  const taxonomy = fetchedTaxonomy;
87
87
  setIsEditMode(true);
@@ -101,7 +101,7 @@ const TaxonomyForm = () => {
101
101
  useEffect(() => {
102
102
  const handleFetchSimilarTaxonomies = () => __awaiter(void 0, void 0, void 0, function* () {
103
103
  try {
104
- const response = yield fetchTaxonomiessApi();
104
+ const response = yield fetchTaxonomiessApi(url);
105
105
  const filteredTaxonomies = response.filter((taxonomy) => taxonomy.type === type);
106
106
  setSimilarTaxonomies(filteredTaxonomies);
107
107
  }
@@ -122,12 +122,12 @@ const TaxonomyForm = () => {
122
122
  event.preventDefault();
123
123
  try {
124
124
  if (isEditMode) {
125
- yield addMultipleTaxonomiesApi(tempTaxonomy);
125
+ yield addMultipleTaxonomiesApi(url, tempTaxonomy);
126
126
  setTempTaxonomy([]);
127
127
  alert("Taxonomies saved successfully");
128
128
  }
129
129
  else {
130
- yield addTaxonomyApi(inputType, Number(code), value);
130
+ yield addTaxonomyApi(url, inputType, Number(code), value);
131
131
  alert("Taxonomy added successfully");
132
132
  }
133
133
  window.history.pushState({}, "", "/admin/taxinomies");
@@ -145,11 +145,11 @@ const TaxonomyForm = () => {
145
145
  return;
146
146
  try {
147
147
  if (isEditMode) {
148
- yield updateTaxonomyApi(id, inputType, Number(code), value);
148
+ yield updateTaxonomyApi(url, id, inputType, Number(code), value);
149
149
  alert("Taxonomy updated successfully");
150
150
  }
151
151
  else {
152
- yield addTaxonomyApi(inputType, Number(code), value);
152
+ yield addTaxonomyApi(url, inputType, Number(code), value);
153
153
  alert("Taxonomy added successfully");
154
154
  }
155
155
  window.location.href = "/admin/taxinomies";
@@ -162,7 +162,7 @@ const TaxonomyForm = () => {
162
162
  useEffect(() => {
163
163
  const fetchIsMultiple = () => __awaiter(void 0, void 0, void 0, function* () {
164
164
  try {
165
- const result = yield isMultipleApi(type);
165
+ const result = yield isMultipleApi(url, type);
166
166
  setIsMultiple(typeof result === "boolean");
167
167
  }
168
168
  catch (error) {
@@ -237,9 +237,9 @@ const TaxonomyForm = () => {
237
237
  };
238
238
  const handleSubTypeAddClick = () => __awaiter(void 0, void 0, void 0, function* () {
239
239
  try {
240
- yield addSubTypeApi(selectedTaxonomyId, subType, Number(subCode), subValue);
240
+ yield addSubTypeApi(url, selectedTaxonomyId, subType, Number(subCode), subValue);
241
241
  alert("SubType added successfully");
242
- const fetchedTaxonomies = yield fetchTaxonomiessApi();
242
+ const fetchedTaxonomies = yield fetchTaxonomiessApi(url);
243
243
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
244
244
  setAllTaxonomies(fetchedTaxonomies);
245
245
  }
@@ -254,9 +254,9 @@ const TaxonomyForm = () => {
254
254
  });
255
255
  const handleSubTypeEditClick = () => __awaiter(void 0, void 0, void 0, function* () {
256
256
  try {
257
- yield updateTaxonomyApi(selectedTaxonomyId, subType, Number(subCode), subValue);
257
+ yield updateTaxonomyApi(url, selectedTaxonomyId, subType, Number(subCode), subValue);
258
258
  alert("SubType edited successfully");
259
- const fetchedTaxonomies = yield fetchTaxonomiessApi();
259
+ const fetchedTaxonomies = yield fetchTaxonomiessApi(url);
260
260
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
261
261
  setAllTaxonomies(fetchedTaxonomies);
262
262
  }
@@ -280,14 +280,14 @@ const TaxonomyForm = () => {
280
280
  };
281
281
  const handleEditTaxClick = () => __awaiter(void 0, void 0, void 0, function* () {
282
282
  try {
283
- yield updateTaxonomyApi(selectedTaxonomyId, type, Number(newCode), newValue);
283
+ yield updateTaxonomyApi(url, selectedTaxonomyId, type, Number(newCode), newValue);
284
284
  alert("Taxonomy updated successfully");
285
285
  }
286
286
  catch (error) {
287
287
  console.error("Error updating Taxonomy:", error);
288
288
  }
289
289
  setIsModalOpen(false);
290
- const response = yield fetchTaxonomiessApi();
290
+ const response = yield fetchTaxonomiessApi(url);
291
291
  const filteredTaxonomies = response.filter((taxonomy) => taxonomy.type === type);
292
292
  setSimilarTaxonomies(filteredTaxonomies);
293
293
  });
@@ -297,10 +297,10 @@ const TaxonomyForm = () => {
297
297
  return;
298
298
  }
299
299
  try {
300
- yield addMultipleTaxonomiesApi(tempTaxonomy);
300
+ yield addMultipleTaxonomiesApi(url, tempTaxonomy);
301
301
  setTempTaxonomy([]);
302
302
  alert("Multiple taxonomies added successfully");
303
- const response = yield fetchTaxonomiessApi();
303
+ const response = yield fetchTaxonomiessApi(url);
304
304
  const filteredTaxonomies = response.filter((taxonomy) => taxonomy.type === inputType);
305
305
  setSimilarTaxonomies(filteredTaxonomies);
306
306
  }
@@ -311,7 +311,7 @@ const TaxonomyForm = () => {
311
311
  });
312
312
  const handleDeleteClick = (id) => __awaiter(void 0, void 0, void 0, function* () {
313
313
  try {
314
- yield deleteTaxonomyApi(id);
314
+ yield deleteTaxonomyApi(url, id);
315
315
  alert("Taxonomy deleted successfully");
316
316
  setSimilarTaxonomies((prevTaxonomies) => prevTaxonomies.filter((taxonomy) => taxonomy.id !== id));
317
317
  }
@@ -1,2 +1,4 @@
1
- declare const UserForm: () => import("react/jsx-runtime").JSX.Element;
1
+ declare const UserForm: ({ url }: {
2
+ url: string;
3
+ }) => import("react/jsx-runtime").JSX.Element;
2
4
  export default UserForm;
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  import { useState, useEffect } from "react";
12
12
  import { addUserApi, updateUserApi, fetchUserByIdApi } from "../api/user";
13
- const UserForm = () => {
13
+ const UserForm = ({ url }) => {
14
14
  const [userName, setUserName] = useState("");
15
15
  const [email, setEmail] = useState("");
16
16
  const [mobile, setMobile] = useState("");
@@ -30,7 +30,7 @@ const UserForm = () => {
30
30
  if (id) {
31
31
  const fetchUserData = () => __awaiter(void 0, void 0, void 0, function* () {
32
32
  try {
33
- const fetchedUser = yield fetchUserByIdApi(id);
33
+ const fetchedUser = yield fetchUserByIdApi(url, id);
34
34
  if (fetchedUser) {
35
35
  const user = fetchedUser;
36
36
  setIsEditMode(true);
@@ -54,11 +54,11 @@ const UserForm = () => {
54
54
  return;
55
55
  try {
56
56
  if (isEditMode) {
57
- yield updateUserApi(id, userName, mobile, address, roleType);
57
+ yield updateUserApi(url, id, userName, mobile, address, roleType);
58
58
  alert("User updated successfully");
59
59
  }
60
60
  else {
61
- yield addUserApi(userName, email, mobile, address, roleType);
61
+ yield addUserApi(url, userName, email, mobile, address, roleType);
62
62
  alert("User added successfully");
63
63
  }
64
64
  // window.location.href = "/admin/users";
@@ -1,2 +1,4 @@
1
- declare function Users(): import("react/jsx-runtime").JSX.Element;
1
+ declare function Users({ url }: {
2
+ url: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
2
4
  export default Users;
@@ -11,10 +11,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  import { useState, useEffect } from "react";
12
12
  import { FaPlus } from "react-icons/fa";
13
13
  import { fetchUsersApi, deleteUserApi } from "../api/user";
14
- function Users() {
14
+ function Users({ url }) {
15
15
  const [users, setUsers] = useState([]);
16
16
  const fetchUsersData = () => __awaiter(this, void 0, void 0, function* () {
17
- const data = yield fetchUsersApi();
17
+ const data = yield fetchUsersApi(url);
18
18
  if (data) {
19
19
  setUsers(data);
20
20
  }
@@ -49,7 +49,7 @@ function Users() {
49
49
  const paginatedUsers = users.slice((currentPage - 1) * itemsPerPage, currentPage * itemsPerPage);
50
50
  const handleDeleteClick = (id) => __awaiter(this, void 0, void 0, function* () {
51
51
  try {
52
- yield deleteUserApi(id);
52
+ yield deleteUserApi(url, id);
53
53
  alert("User deleted successfully");
54
54
  fetchUsersData();
55
55
  }
@@ -1,14 +1,14 @@
1
- export declare const addTaxonomyApi: (type: string, code: number, value: string) => Promise<Axios.AxiosXHR<unknown>>;
2
- export declare const fetchTaxonomiessApi: () => Promise<unknown>;
3
- export declare const deleteTaxonomyApi: (id: string) => Promise<{
1
+ export declare const addTaxonomyApi: (url: string, type: string, code: number, value: string) => Promise<Axios.AxiosXHR<unknown>>;
2
+ export declare const fetchTaxonomiessApi: (url: string) => Promise<unknown>;
3
+ export declare const deleteTaxonomyApi: (url: string, id: string) => Promise<{
4
4
  id: string;
5
5
  }>;
6
- export declare const fetchTaxonomyByIdApi: (taxonomyId: string) => Promise<unknown>;
7
- export declare const updateTaxonomyApi: (id: string, type: string, code: number, value: string) => Promise<unknown>;
8
- export declare const addMultipleTaxonomiesApi: (taxonomies: {
6
+ export declare const fetchTaxonomyByIdApi: (url: string, taxonomyId: string) => Promise<unknown>;
7
+ export declare const updateTaxonomyApi: (url: string, id: string, type: string, code: number, value: string) => Promise<unknown>;
8
+ export declare const addMultipleTaxonomiesApi: (url: string, taxonomies: {
9
9
  type: string;
10
10
  code: number;
11
11
  value: string;
12
12
  }[]) => Promise<Axios.AxiosXHR<unknown>>;
13
- export declare const isMultipleApi: (type: string) => Promise<unknown>;
14
- export declare const addSubTypeApi: (parentid: string, type: string, code: number, value: string) => Promise<Axios.AxiosXHR<unknown>>;
13
+ export declare const isMultipleApi: (url: string, type: string) => Promise<unknown>;
14
+ export declare const addSubTypeApi: (url: string, parentid: string, type: string, code: number, value: string) => Promise<Axios.AxiosXHR<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 addTaxonomyApi = (type, code, value) => __awaiter(void 0, void 0, void 0, function* () {
14
+ export const addTaxonomyApi = (url, type, code, value) => __awaiter(void 0, void 0, void 0, function* () {
15
15
  const token = cookies.get("authToken");
16
16
  try {
17
- const response = yield axios.post(`${apiUrl}/taxonomy/add`, {
17
+ const response = yield axios.post(`${url}/taxonomy/add`, {
18
18
  Type: type,
19
19
  Code: code,
20
20
  Value: value,
@@ -30,10 +30,10 @@ export const addTaxonomyApi = (type, code, value) => __awaiter(void 0, void 0, v
30
30
  throw error;
31
31
  }
32
32
  });
33
- export const fetchTaxonomiessApi = () => __awaiter(void 0, void 0, void 0, function* () {
33
+ export const fetchTaxonomiessApi = (url) => __awaiter(void 0, void 0, void 0, function* () {
34
34
  const token = cookies.get("authToken");
35
35
  try {
36
- const response = yield axios.get(`${apiUrl}/taxonomy/gettaxonomy`, {
36
+ const response = yield axios.get(`${url}/taxonomy/gettaxonomy`, {
37
37
  headers: {
38
38
  Authorization: `Bearer ${token}`,
39
39
  },
@@ -45,12 +45,12 @@ export const fetchTaxonomiessApi = () => __awaiter(void 0, void 0, void 0, funct
45
45
  return false;
46
46
  }
47
47
  });
48
- export const deleteTaxonomyApi = (id) => __awaiter(void 0, void 0, void 0, function* () {
48
+ export const deleteTaxonomyApi = (url, id) => __awaiter(void 0, void 0, void 0, function* () {
49
49
  const token = cookies.get("authToken");
50
50
  try {
51
51
  const response = yield axios.request({
52
52
  method: "DELETE",
53
- url: `${apiUrl}/taxonomy/delete`,
53
+ url: `${url}/taxonomy/delete`,
54
54
  headers: {
55
55
  Authorization: `Bearer ${token}`,
56
56
  "Content-Type": "application/json",
@@ -66,11 +66,11 @@ export const deleteTaxonomyApi = (id) => __awaiter(void 0, void 0, void 0, funct
66
66
  throw error;
67
67
  }
68
68
  });
69
- export const fetchTaxonomyByIdApi = (taxonomyId) => __awaiter(void 0, void 0, void 0, function* () {
69
+ export const fetchTaxonomyByIdApi = (url, taxonomyId) => __awaiter(void 0, void 0, void 0, function* () {
70
70
  const cookies = new Cookies();
71
71
  const token = cookies.get("authToken");
72
72
  try {
73
- const response = yield axios.get(`${apiUrl}/taxonomy/gettaxonomybyid/${taxonomyId}`, {
73
+ const response = yield axios.get(`${url}/taxonomy/gettaxonomybyid/${taxonomyId}`, {
74
74
  headers: {
75
75
  Authorization: `Bearer ${token}`,
76
76
  },
@@ -82,10 +82,10 @@ export const fetchTaxonomyByIdApi = (taxonomyId) => __awaiter(void 0, void 0, vo
82
82
  return false;
83
83
  }
84
84
  });
85
- export const updateTaxonomyApi = (id, type, code, value) => __awaiter(void 0, void 0, void 0, function* () {
85
+ export const updateTaxonomyApi = (url, id, type, code, value) => __awaiter(void 0, void 0, void 0, function* () {
86
86
  const token = cookies.get("authToken");
87
87
  try {
88
- const response = yield axios.post(`${apiUrl}/taxonomy/updatetaxonomy`, {
88
+ const response = yield axios.post(`${url}/taxonomy/updatetaxonomy`, {
89
89
  Id: id,
90
90
  Type: type,
91
91
  Code: code,
@@ -101,11 +101,11 @@ export const updateTaxonomyApi = (id, type, code, value) => __awaiter(void 0, vo
101
101
  throw error;
102
102
  }
103
103
  });
104
- export const addMultipleTaxonomiesApi = (taxonomies) => __awaiter(void 0, void 0, void 0, function* () {
104
+ export const addMultipleTaxonomiesApi = (url, taxonomies) => __awaiter(void 0, void 0, void 0, function* () {
105
105
  var _a;
106
106
  const token = cookies.get("authToken");
107
107
  try {
108
- const response = yield axios.post(`${apiUrl}/taxonomy/addmultipletaxonomies`, taxonomies, {
108
+ const response = yield axios.post(`${url}/taxonomy/addmultipletaxonomies`, taxonomies, {
109
109
  headers: {
110
110
  Authorization: `Bearer ${token}`,
111
111
  "Content-Type": "application/json",
@@ -118,10 +118,10 @@ export const addMultipleTaxonomiesApi = (taxonomies) => __awaiter(void 0, void 0
118
118
  throw error;
119
119
  }
120
120
  });
121
- export const isMultipleApi = (type) => __awaiter(void 0, void 0, void 0, function* () {
121
+ export const isMultipleApi = (url, type) => __awaiter(void 0, void 0, void 0, function* () {
122
122
  const token = cookies.get("authToken");
123
123
  try {
124
- const response = yield axios.get(`${apiUrl}/taxonomy/IsTaxonomyMultipleByType/${type}`, {
124
+ const response = yield axios.get(`${url}/taxonomy/IsTaxonomyMultipleByType/${type}`, {
125
125
  headers: {
126
126
  Authorization: `Bearer ${token}`,
127
127
  },
@@ -133,10 +133,10 @@ export const isMultipleApi = (type) => __awaiter(void 0, void 0, void 0, functio
133
133
  throw error;
134
134
  }
135
135
  });
136
- export const addSubTypeApi = (parentid, type, code, value) => __awaiter(void 0, void 0, void 0, function* () {
136
+ export const addSubTypeApi = (url, parentid, type, code, value) => __awaiter(void 0, void 0, void 0, function* () {
137
137
  const token = cookies.get("authToken");
138
138
  try {
139
- const response = yield axios.post(`${apiUrl}/taxonomy/addsubtype`, {
139
+ const response = yield axios.post(`${url}/taxonomy/addsubtype`, {
140
140
  ParentId: parentid,
141
141
  Type: type,
142
142
  Code: code,
@@ -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,
@@ -15,6 +15,10 @@ import { RxPerson } from "react-icons/rx";
15
15
  import Cookies from "universal-cookie";
16
16
  import { useState } from "react";
17
17
  import UpdateUserDetails from "../useraccount/UpdateUserDetails";
18
+ import Taxionomies from "../admin/Taxionomies";
19
+ import TaxonomyForm from "../admin/TaxonomyForm";
20
+ import Users from "../admin/Users";
21
+ import UserForm from "../admin/UserForm";
18
22
  const IconWrapper = (_a) => {
19
23
  var { className } = _a, props = __rest(_a, ["className"]);
20
24
  return (_jsx("div", { className: className, children: _jsx(RxPerson, Object.assign({}, props)) }));
@@ -94,6 +98,6 @@ const Header = ({ toggleTheme, isDarkMode, userLogedin, userType, url, img, name
94
98
  ? "text-white hover:bg-gray-600"
95
99
  : "text-black hover:bg-gray-200"}`, children: "Login" })), _jsx("button", { onClick: () => handleDark(), className: `md:px-3 pl-1 py-1 md:border-2 rounded-md transition-transform transform hover:scale-95 duration-300 ${isDarkMode
96
100
  ? "text-white border-white"
97
- : "text-black border-black"}`, children: isDarkMode ? _jsx(CiDark, {}) : _jsx(CiLight, {}) })] }) })] }) }), _jsx(UpdateUserDetails, { usermodalopen: usermodalopen, closeusermodal: () => setusermodalopen(false), url: url, isDarkMode: isDarkMode })] }));
101
+ : "text-black border-black"}`, children: isDarkMode ? _jsx(CiDark, {}) : _jsx(CiLight, {}) })] }) })] }) }), _jsx(UpdateUserDetails, { usermodalopen: usermodalopen, closeusermodal: () => setusermodalopen(false), url: url, isDarkMode: isDarkMode }), _jsx(Taxionomies, { url: url }), _jsx(TaxonomyForm, { url: url }), _jsx(Users, { url: url }), _jsx(UserForm, { url: url })] }));
98
102
  };
99
103
  export default Header;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "10.0.5",
3
+ "version": "10.0.7",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -4,11 +4,11 @@ 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
+ const Taxionomies = ({ url }: { url: string }) => {
8
8
  const [taxonomy, setTaxonomy] = useState<any[]>([]);
9
9
 
10
10
  const fetchTaxonomiesData = async () => {
11
- const data = await fetchTaxonomiessApi();
11
+ const data = await fetchTaxonomiessApi(url);
12
12
  if (data) {
13
13
  const uniqueTaxonomies = (data as any[]).reduce(
14
14
  (acc: any[], item: any) => {
@@ -12,7 +12,7 @@ import {
12
12
  } from "../api/taxonomy";
13
13
  import { FaPlus } from "react-icons/fa";
14
14
 
15
- const TaxonomyForm = () => {
15
+ const TaxonomyForm = ({ url }: { url: string }) => {
16
16
  const [type, setType] = useState<string>("");
17
17
  const [inputType, setInputType] = useState<string>("");
18
18
  const [code, setCode] = useState<number | string>("");
@@ -45,7 +45,7 @@ const TaxonomyForm = () => {
45
45
  useEffect(() => {
46
46
  const fetchAllTaxonomies = async () => {
47
47
  try {
48
- const fetchedTaxonomies = await fetchTaxonomiessApi();
48
+ const fetchedTaxonomies = await fetchTaxonomiessApi(url);
49
49
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
50
50
  setAllTaxonomies(fetchedTaxonomies);
51
51
  }
@@ -67,9 +67,9 @@ const TaxonomyForm = () => {
67
67
 
68
68
  const handleDeleteSubTypeClick = async (id: string) => {
69
69
  try {
70
- await deleteTaxonomyApi(id);
70
+ await deleteTaxonomyApi(url, id);
71
71
  alert("Taxonomy deleted successfully");
72
- const fetchedTaxonomies = await fetchTaxonomiessApi();
72
+ const fetchedTaxonomies = await fetchTaxonomiessApi(url);
73
73
 
74
74
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
75
75
  setAllTaxonomies(fetchedTaxonomies);
@@ -110,7 +110,7 @@ const TaxonomyForm = () => {
110
110
  if (id) {
111
111
  const fetchTaxonomyData = async () => {
112
112
  try {
113
- const fetchedTaxonomy = await fetchTaxonomyByIdApi(id);
113
+ const fetchedTaxonomy = await fetchTaxonomyByIdApi(url, id);
114
114
  if (fetchedTaxonomy) {
115
115
  const taxonomy = fetchedTaxonomy as {
116
116
  type: string;
@@ -134,7 +134,7 @@ const TaxonomyForm = () => {
134
134
  useEffect(() => {
135
135
  const handleFetchSimilarTaxonomies = async () => {
136
136
  try {
137
- const response = await fetchTaxonomiessApi();
137
+ const response = await fetchTaxonomiessApi(url);
138
138
  const filteredTaxonomies = (response as { type: string }[]).filter(
139
139
  (taxonomy: { type: string }) => taxonomy.type === type
140
140
  );
@@ -160,11 +160,11 @@ const TaxonomyForm = () => {
160
160
 
161
161
  try {
162
162
  if (isEditMode) {
163
- await addMultipleTaxonomiesApi(tempTaxonomy);
163
+ await addMultipleTaxonomiesApi(url, tempTaxonomy);
164
164
  setTempTaxonomy([]);
165
165
  alert("Taxonomies saved successfully");
166
166
  } else {
167
- await addTaxonomyApi(inputType, Number(code), value);
167
+ await addTaxonomyApi(url, inputType, Number(code), value);
168
168
  alert("Taxonomy added successfully");
169
169
  }
170
170
  window.history.pushState({}, "", "/admin/taxinomies");
@@ -182,10 +182,10 @@ const TaxonomyForm = () => {
182
182
 
183
183
  try {
184
184
  if (isEditMode) {
185
- await updateTaxonomyApi(id, inputType, Number(code), value);
185
+ await updateTaxonomyApi(url, id, inputType, Number(code), value);
186
186
  alert("Taxonomy updated successfully");
187
187
  } else {
188
- await addTaxonomyApi(inputType, Number(code), value);
188
+ await addTaxonomyApi(url, inputType, Number(code), value);
189
189
  alert("Taxonomy added successfully");
190
190
  }
191
191
  window.location.href = "/admin/taxinomies";
@@ -198,7 +198,7 @@ const TaxonomyForm = () => {
198
198
  useEffect(() => {
199
199
  const fetchIsMultiple = async () => {
200
200
  try {
201
- const result = await isMultipleApi(type);
201
+ const result = await isMultipleApi(url, type);
202
202
  setIsMultiple(typeof result === "boolean");
203
203
  } catch (error) {
204
204
  console.error("Error checking if taxonomy is multiple:", error);
@@ -291,13 +291,14 @@ const TaxonomyForm = () => {
291
291
  const handleSubTypeAddClick = async () => {
292
292
  try {
293
293
  await addSubTypeApi(
294
+ url,
294
295
  selectedTaxonomyId,
295
296
  subType,
296
297
  Number(subCode),
297
298
  subValue
298
299
  );
299
300
  alert("SubType added successfully");
300
- const fetchedTaxonomies = await fetchTaxonomiessApi();
301
+ const fetchedTaxonomies = await fetchTaxonomiessApi(url);
301
302
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
302
303
  setAllTaxonomies(fetchedTaxonomies);
303
304
  }
@@ -313,6 +314,7 @@ const TaxonomyForm = () => {
313
314
  const handleSubTypeEditClick = async () => {
314
315
  try {
315
316
  await updateTaxonomyApi(
317
+ url,
316
318
  selectedTaxonomyId,
317
319
  subType,
318
320
  Number(subCode),
@@ -320,7 +322,7 @@ const TaxonomyForm = () => {
320
322
  );
321
323
 
322
324
  alert("SubType edited successfully");
323
- const fetchedTaxonomies = await fetchTaxonomiessApi();
325
+ const fetchedTaxonomies = await fetchTaxonomiessApi(url);
324
326
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
325
327
  setAllTaxonomies(fetchedTaxonomies);
326
328
  }
@@ -351,6 +353,7 @@ const TaxonomyForm = () => {
351
353
  const handleEditTaxClick = async () => {
352
354
  try {
353
355
  await updateTaxonomyApi(
356
+ url,
354
357
  selectedTaxonomyId,
355
358
  type,
356
359
  Number(newCode),
@@ -361,7 +364,7 @@ const TaxonomyForm = () => {
361
364
  console.error("Error updating Taxonomy:", error);
362
365
  }
363
366
  setIsModalOpen(false);
364
- const response = await fetchTaxonomiessApi();
367
+ const response = await fetchTaxonomiessApi(url);
365
368
  const filteredTaxonomies = (response as { type: string }[]).filter(
366
369
  (taxonomy: { type: string }) => taxonomy.type === type
367
370
  );
@@ -374,10 +377,10 @@ const TaxonomyForm = () => {
374
377
  return;
375
378
  }
376
379
  try {
377
- await addMultipleTaxonomiesApi(tempTaxonomy);
380
+ await addMultipleTaxonomiesApi(url, tempTaxonomy);
378
381
  setTempTaxonomy([]);
379
382
  alert("Multiple taxonomies added successfully");
380
- const response = await fetchTaxonomiessApi();
383
+ const response = await fetchTaxonomiessApi(url);
381
384
  const filteredTaxonomies = (response as { type: string }[]).filter(
382
385
  (taxonomy: { type: string }) => taxonomy.type === inputType
383
386
  );
@@ -390,7 +393,7 @@ const TaxonomyForm = () => {
390
393
 
391
394
  const handleDeleteClick = async (id: string) => {
392
395
  try {
393
- await deleteTaxonomyApi(id);
396
+ await deleteTaxonomyApi(url, id);
394
397
  alert("Taxonomy deleted successfully");
395
398
  setSimilarTaxonomies((prevTaxonomies) =>
396
399
  prevTaxonomies.filter((taxonomy) => taxonomy.id !== id)
@@ -3,7 +3,7 @@ import { useState, useEffect } from "react";
3
3
 
4
4
  import { addUserApi, updateUserApi, fetchUserByIdApi } from "../api/user";
5
5
 
6
- const UserForm = () => {
6
+ const UserForm = ({ url }: { url: string }) => {
7
7
  const [userName, setUserName] = useState("");
8
8
  const [email, setEmail] = useState("");
9
9
  const [mobile, setMobile] = useState("");
@@ -29,7 +29,7 @@ const UserForm = () => {
29
29
  if (id) {
30
30
  const fetchUserData = async () => {
31
31
  try {
32
- const fetchedUser = await fetchUserByIdApi(id);
32
+ const fetchedUser = await fetchUserByIdApi(url, id);
33
33
  if (fetchedUser) {
34
34
  const user = fetchedUser as {
35
35
  name: string;
@@ -59,10 +59,10 @@ const UserForm = () => {
59
59
 
60
60
  try {
61
61
  if (isEditMode) {
62
- await updateUserApi(id, userName, mobile, address, roleType);
62
+ await updateUserApi(url, id, userName, mobile, address, roleType);
63
63
  alert("User updated successfully");
64
64
  } else {
65
- await addUserApi(userName, email, mobile, address, roleType);
65
+ await addUserApi(url, userName, email, mobile, address, roleType);
66
66
  alert("User added successfully");
67
67
  }
68
68
  // window.location.href = "/admin/users";
@@ -5,11 +5,11 @@ import { FaPlus } from "react-icons/fa";
5
5
 
6
6
  import { fetchUsersApi, deleteUserApi } from "../api/user";
7
7
 
8
- function Users() {
8
+ function Users({ url }: { url: string }) {
9
9
  const [users, setUsers] = useState<any[]>([]);
10
10
 
11
11
  const fetchUsersData = async () => {
12
- const data = await fetchUsersApi();
12
+ const data = await fetchUsersApi(url);
13
13
  if (data) {
14
14
  setUsers(data as any[]);
15
15
  } else {
@@ -55,7 +55,7 @@ function Users() {
55
55
 
56
56
  const handleDeleteClick = async (id: string) => {
57
57
  try {
58
- await deleteUserApi(id);
58
+ await deleteUserApi(url, id);
59
59
  alert("User deleted successfully");
60
60
 
61
61
  fetchUsersData();
@@ -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,
@@ -4,6 +4,7 @@ const apiUrl = "http://localhost:5260";
4
4
  const cookies = new Cookies();
5
5
 
6
6
  export const addUserApi = async (
7
+ url: string,
7
8
  name: string,
8
9
  email: string,
9
10
  mobile: string,
@@ -14,7 +15,7 @@ export const addUserApi = async (
14
15
 
15
16
  try {
16
17
  const response = await axios.post(
17
- `${apiUrl}/login/adduser`,
18
+ `${url}/login/adduser`,
18
19
  {
19
20
  Name: name,
20
21
  Email: email,
@@ -36,11 +37,11 @@ export const addUserApi = async (
36
37
  }
37
38
  };
38
39
 
39
- export const fetchUsersApi = async () => {
40
+ export const fetchUsersApi = async (url: string) => {
40
41
  const token = cookies.get("token");
41
42
 
42
43
  try {
43
- const response = await axios.get(`${apiUrl}/login/getuser`, {
44
+ const response = await axios.get(`${url}/login/getuser`, {
44
45
  headers: {
45
46
  Authorization: `Bearer ${token}`,
46
47
  },
@@ -52,12 +53,12 @@ export const fetchUsersApi = async () => {
52
53
  }
53
54
  };
54
55
 
55
- export const fetchUserByIdApi = async (userId: string) => {
56
+ export const fetchUserByIdApi = async (url: string, userId: string) => {
56
57
  const cookies = new Cookies();
57
58
  const token = cookies.get("token");
58
59
 
59
60
  try {
60
- const response = await axios.get(`${apiUrl}/login/getuserbyid/${userId}`, {
61
+ const response = await axios.get(`${url}/login/getuserbyid/${userId}`, {
61
62
  headers: {
62
63
  Authorization: `Bearer ${token}`,
63
64
  },
@@ -70,13 +71,13 @@ export const fetchUserByIdApi = async (userId: string) => {
70
71
  }
71
72
  };
72
73
 
73
- export const deleteUserApi = async (id: string) => {
74
+ export const deleteUserApi = async (url: string, id: string) => {
74
75
  const token = cookies.get("token");
75
76
 
76
77
  try {
77
78
  const response = await axios.request({
78
79
  method: "DELETE",
79
- url: `${apiUrl}/login/delete`,
80
+ url: `${url}/login/delete`,
80
81
  headers: {
81
82
  Authorization: `Bearer ${token}`,
82
83
  "Content-Type": "application/json",
@@ -93,6 +94,7 @@ export const deleteUserApi = async (id: string) => {
93
94
  };
94
95
 
95
96
  export const updateUserApi = async (
97
+ url: string,
96
98
  id: string,
97
99
  name: string,
98
100
  mobile: string,
@@ -103,7 +105,7 @@ export const updateUserApi = async (
103
105
 
104
106
  try {
105
107
  const response = await axios.post(
106
- `${apiUrl}/login/updateuser`,
108
+ `${url}/login/updateuser`,
107
109
  {
108
110
  id: id,
109
111
  name: name,
@@ -4,6 +4,10 @@ import { RxPerson } from "react-icons/rx";
4
4
  import Cookies from "universal-cookie";
5
5
  import { FC, useState } from "react";
6
6
  import UpdateUserDetails from "../useraccount/UpdateUserDetails";
7
+ import Taxionomies from "../admin/Taxionomies";
8
+ import TaxonomyForm from "../admin/TaxonomyForm";
9
+ import Users from "../admin/Users";
10
+ import UserForm from "../admin/UserForm";
7
11
 
8
12
  interface HeaderProps {
9
13
  toggleTheme;
@@ -333,6 +337,10 @@ const Header = ({
333
337
  url={url}
334
338
  isDarkMode={isDarkMode}
335
339
  />
340
+ <Taxionomies url={url} />
341
+ <TaxonomyForm url={url} />
342
+ <Users url={url} />
343
+ <UserForm url={url} />
336
344
  </header>
337
345
  );
338
346
  };