eleven-solutions-common-website-unique-web 22.0.13 → 22.0.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,10 +31,43 @@ const UserForm = ({ url }) => {
31
31
  };
32
32
  const queryParams = new URLSearchParams(window.location.search);
33
33
  const id = queryParams.get("id");
34
+ // useEffect(() => {
35
+ // try {
36
+ // if (id) {
37
+ // const fetchUserData = async () => {
38
+ // const fetchedUser = await fetchUserByIdApi(url, id);
39
+ // if (fetchedUser) {
40
+ // const user = fetchedUser as {
41
+ // name: string;
42
+ // email: string;
43
+ // mobile: string;
44
+ // address: string;
45
+ // roleType: string;
46
+ // gender: string;
47
+ // };
48
+ // setIsEditMode(true);
49
+ // setLoading(false);
50
+ // setUserName(user.name);
51
+ // setEmail(user.email);
52
+ // setMobile(user.mobile);
53
+ // setAddress(user.address);
54
+ // setRoleType(user.roleType);
55
+ // setGender(user.gender);
56
+ // }
57
+ // };
58
+ // fetchUserData();
59
+ // }
60
+ // } catch (error) {
61
+ // console.error("Error fetching User:", error);
62
+ // toast.error("Failed to fetch the User.", { id: "fetchUserError" });
63
+ // setHasError(true);
64
+ // setLoading(false);
65
+ // }
66
+ // }, [id]);
34
67
  useEffect(() => {
35
- try {
36
- if (id) {
37
- const fetchUserData = () => __awaiter(void 0, void 0, void 0, function* () {
68
+ const fetchUserData = () => __awaiter(void 0, void 0, void 0, function* () {
69
+ try {
70
+ if (id) {
38
71
  const fetchedUser = yield fetchUserByIdApi(url, id);
39
72
  if (fetchedUser) {
40
73
  const user = fetchedUser;
@@ -47,17 +80,19 @@ const UserForm = ({ url }) => {
47
80
  setRoleType(user.roleType);
48
81
  setGender(user.gender);
49
82
  }
50
- });
51
- fetchUserData();
83
+ }
52
84
  }
85
+ catch (error) {
86
+ console.error("Error fetching User:", error);
87
+ toast.error("Failed to fetch the User.", { id: "fetchUserError" });
88
+ setHasError(true);
89
+ setLoading(false);
90
+ }
91
+ });
92
+ if (id) {
93
+ fetchUserData();
53
94
  }
54
- catch (error) {
55
- console.error("Error fetching User:", error);
56
- toast.error("Failed to fetch the User.", { id: "fetchUserError" });
57
- setHasError(true);
58
- setLoading(false);
59
- }
60
- }, [id]);
95
+ }, [id, url]);
61
96
  useEffect(() => {
62
97
  if (id) {
63
98
  setUid(id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "22.0.13",
3
+ "version": "22.0.14",
4
4
  "main": "./dist/index.js",
5
5
  "files": [
6
6
  "dist"