eleven-solutions-common-website-unique-web 3.0.21 → 3.0.23
Sign up to get free protection for your applications and to get access to all the features.
@@ -16,7 +16,6 @@ const UserForm = () => {
|
|
16
16
|
const [mobile, setMobile] = useState("");
|
17
17
|
const [address, setAddress] = useState("");
|
18
18
|
const [roleType, setRoleType] = useState("");
|
19
|
-
const [, setUser] = useState(null);
|
20
19
|
const [isEditMode, setIsEditMode] = useState(false);
|
21
20
|
const validateForm = () => {
|
22
21
|
if (!userName || !email || !roleType) {
|
@@ -35,7 +34,6 @@ const UserForm = () => {
|
|
35
34
|
if (fetchedUser) {
|
36
35
|
const user = fetchedUser;
|
37
36
|
setIsEditMode(true);
|
38
|
-
setUser(user);
|
39
37
|
setUserName(user.name);
|
40
38
|
setEmail(user.email);
|
41
39
|
setMobile(user.mobile);
|
@@ -50,23 +48,6 @@ const UserForm = () => {
|
|
50
48
|
fetchUserData();
|
51
49
|
}
|
52
50
|
}, [id]);
|
53
|
-
// const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement>) => {
|
54
|
-
// event.preventDefault();
|
55
|
-
// if (!validateForm()) return;
|
56
|
-
// try {
|
57
|
-
// if (isEditMode) {
|
58
|
-
// await updateUserApi(id, userName, mobile, address, roleType);
|
59
|
-
// alert("User updated successfully");
|
60
|
-
// } else {
|
61
|
-
// await addUserApi(userName, email, mobile, address, roleType);
|
62
|
-
// alert("User added successfully");
|
63
|
-
// }
|
64
|
-
// navigate("/admin/user");
|
65
|
-
// } catch (error) {
|
66
|
-
// console.error("Error adding/updating User:", error);
|
67
|
-
// alert("Failed to add/update User");
|
68
|
-
// }
|
69
|
-
// };
|
70
51
|
const handleSubmit = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
71
52
|
event.preventDefault();
|
72
53
|
if (!validateForm())
|
package/package.json
CHANGED
@@ -10,7 +10,6 @@ const UserForm = () => {
|
|
10
10
|
const [address, setAddress] = useState("");
|
11
11
|
const [roleType, setRoleType] = useState("");
|
12
12
|
|
13
|
-
const [, setUser] = useState<any>(null);
|
14
13
|
const [isEditMode, setIsEditMode] = useState<boolean>(false);
|
15
14
|
|
16
15
|
const validateForm = () => {
|
@@ -40,7 +39,6 @@ const UserForm = () => {
|
|
40
39
|
roleType: string;
|
41
40
|
};
|
42
41
|
setIsEditMode(true);
|
43
|
-
setUser(user);
|
44
42
|
setUserName(user.name);
|
45
43
|
setEmail(user.email);
|
46
44
|
setMobile(user.mobile);
|
@@ -55,25 +53,6 @@ const UserForm = () => {
|
|
55
53
|
}
|
56
54
|
}, [id]);
|
57
55
|
|
58
|
-
// const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement>) => {
|
59
|
-
// event.preventDefault();
|
60
|
-
// if (!validateForm()) return;
|
61
|
-
|
62
|
-
// try {
|
63
|
-
// if (isEditMode) {
|
64
|
-
// await updateUserApi(id, userName, mobile, address, roleType);
|
65
|
-
// alert("User updated successfully");
|
66
|
-
// } else {
|
67
|
-
// await addUserApi(userName, email, mobile, address, roleType);
|
68
|
-
// alert("User added successfully");
|
69
|
-
// }
|
70
|
-
// navigate("/admin/user");
|
71
|
-
// } catch (error) {
|
72
|
-
// console.error("Error adding/updating User:", error);
|
73
|
-
// alert("Failed to add/update User");
|
74
|
-
// }
|
75
|
-
// };
|
76
|
-
|
77
56
|
const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement>) => {
|
78
57
|
event.preventDefault();
|
79
58
|
if (!validateForm()) return;
|
@@ -207,11 +186,3 @@ const UserForm = () => {
|
|
207
186
|
};
|
208
187
|
|
209
188
|
export default UserForm;
|
210
|
-
|
211
|
-
// import React from "react";
|
212
|
-
|
213
|
-
// function UserForm() {
|
214
|
-
// return <div>UserForm</div>;
|
215
|
-
// }
|
216
|
-
|
217
|
-
// export default UserForm;
|