eleven-solutions-common-website-unique-web 3.0.15 → 3.0.17
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,7 @@
|
|
1
1
|
export declare const addUserApi: (name: string, email: string, mobile: string, address: string, roleType: string) => Promise<Axios.AxiosXHR<unknown>>;
|
2
2
|
export declare const fetchUsersApi: () => Promise<unknown>;
|
3
3
|
export declare const fetchUserByIdApi: (userId: string) => Promise<unknown>;
|
4
|
-
export declare const deleteUserApi: (id: string) => Promise<
|
4
|
+
export declare const deleteUserApi: (id: string) => Promise<{
|
5
|
+
id: string;
|
6
|
+
}>;
|
5
7
|
export declare const updateUserApi: (id: string, name: string, mobile: string, address: string, roleType: string) => Promise<unknown>;
|
@@ -63,25 +63,45 @@ export const fetchUserByIdApi = (userId) => __awaiter(void 0, void 0, void 0, fu
|
|
63
63
|
return false;
|
64
64
|
}
|
65
65
|
});
|
66
|
+
// export const deleteUserApi = async (id: string) => {
|
67
|
+
// const token = cookies.get("token");
|
68
|
+
// try {
|
69
|
+
// const response = await axios.delete(`${apiUrl}/login/delete`, {
|
70
|
+
// headers: {
|
71
|
+
// Authorization: `Bearer ${token}`,
|
72
|
+
// "Content-Type": "application/json",
|
73
|
+
// },
|
74
|
+
// // data: {
|
75
|
+
// // id,
|
76
|
+
// // },
|
77
|
+
// params: {
|
78
|
+
// id,
|
79
|
+
// },
|
80
|
+
// });
|
81
|
+
// return response.data;
|
82
|
+
// } catch (error) {
|
83
|
+
// console.error("Error deleting lang:", error);
|
84
|
+
// throw error;
|
85
|
+
// }
|
86
|
+
// };
|
66
87
|
export const deleteUserApi = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
67
88
|
const token = cookies.get("token");
|
68
89
|
try {
|
69
|
-
const response = yield axios.
|
90
|
+
const response = yield axios.request({
|
91
|
+
method: "DELETE",
|
92
|
+
url: `${apiUrl}/login/delete`,
|
70
93
|
headers: {
|
71
94
|
Authorization: `Bearer ${token}`,
|
72
|
-
"Content-Type": "application/json
|
95
|
+
"Content-Type": "application/json",
|
73
96
|
},
|
74
|
-
|
75
|
-
// id,
|
76
|
-
// },
|
77
|
-
params: {
|
97
|
+
data: {
|
78
98
|
id,
|
79
99
|
},
|
80
100
|
});
|
81
101
|
return response.data;
|
82
102
|
}
|
83
103
|
catch (error) {
|
84
|
-
console.error("Error deleting
|
104
|
+
console.error("Error deleting user:", error);
|
85
105
|
throw error;
|
86
106
|
}
|
87
107
|
});
|
package/package.json
CHANGED
@@ -70,25 +70,47 @@ export const fetchUserByIdApi = async (userId: string) => {
|
|
70
70
|
}
|
71
71
|
};
|
72
72
|
|
73
|
+
// export const deleteUserApi = async (id: string) => {
|
74
|
+
// const token = cookies.get("token");
|
75
|
+
|
76
|
+
// try {
|
77
|
+
// const response = await axios.delete(`${apiUrl}/login/delete`, {
|
78
|
+
// headers: {
|
79
|
+
// Authorization: `Bearer ${token}`,
|
80
|
+
// "Content-Type": "application/json",
|
81
|
+
// },
|
82
|
+
// // data: {
|
83
|
+
// // id,
|
84
|
+
// // },
|
85
|
+
// params: {
|
86
|
+
// id,
|
87
|
+
// },
|
88
|
+
// });
|
89
|
+
// return response.data;
|
90
|
+
// } catch (error) {
|
91
|
+
// console.error("Error deleting lang:", error);
|
92
|
+
// throw error;
|
93
|
+
// }
|
94
|
+
// };
|
95
|
+
|
73
96
|
export const deleteUserApi = async (id: string) => {
|
74
97
|
const token = cookies.get("token");
|
75
98
|
|
76
99
|
try {
|
77
|
-
const response = await axios.
|
100
|
+
const response = await axios.request({
|
101
|
+
method: "DELETE",
|
102
|
+
url: `${apiUrl}/login/delete`,
|
78
103
|
headers: {
|
79
104
|
Authorization: `Bearer ${token}`,
|
80
|
-
"Content-Type": "application/json
|
105
|
+
"Content-Type": "application/json",
|
81
106
|
},
|
82
|
-
|
83
|
-
// id,
|
84
|
-
// },
|
85
|
-
params: {
|
107
|
+
data: {
|
86
108
|
id,
|
87
109
|
},
|
88
110
|
});
|
89
111
|
return response.data;
|
90
112
|
} catch (error) {
|
91
|
-
console.error("Error deleting
|
113
|
+
console.error("Error deleting user:", error);
|
92
114
|
throw error;
|
93
115
|
}
|
94
116
|
};
|