eleven-solutions-common-website-unique-web 20.0.2 → 20.0.4
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.
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/useraccount/UpdateUserDetails.js +1 -0
- package/package.json +1 -1
- package/src/components/index.ts +2 -0
- package/src/components/useraccount/UpdateUserDetails.tsx +1 -0
- package/src/components/useraccount/AddMissingDetails.tsx +0 -153
@@ -14,3 +14,4 @@ export { default as Editor } from "./admin/Editor";
|
|
14
14
|
export { default as AdminSideBar } from "./admin/Sidebar";
|
15
15
|
export { default as Dashboard } from "./admin/Dashboard";
|
16
16
|
export { registerApi, loginApi } from "./api/api";
|
17
|
+
export { default as UpdateUserDetails } from "./useraccount/UpdateUserDetails";
|
package/dist/components/index.js
CHANGED
@@ -15,3 +15,4 @@ export { default as Editor } from "./admin/Editor";
|
|
15
15
|
export { default as AdminSideBar } from "./admin/Sidebar";
|
16
16
|
export { default as Dashboard } from "./admin/Dashboard";
|
17
17
|
export { registerApi, loginApi } from "./api/api";
|
18
|
+
export { default as UpdateUserDetails } from "./useraccount/UpdateUserDetails";
|
@@ -45,6 +45,7 @@ const UpdateUserDetails = ({ usermodalopen, closeusermodal, url, isDarkMode, })
|
|
45
45
|
if (response.status === 200) {
|
46
46
|
alert("Updated Successfully");
|
47
47
|
closeusermodal();
|
48
|
+
window.location.reload();
|
48
49
|
}
|
49
50
|
else {
|
50
51
|
console.error("Update failed:", response.statusText);
|
package/package.json
CHANGED
package/src/components/index.ts
CHANGED
@@ -15,3 +15,5 @@ export { default as Editor } from "./admin/Editor";
|
|
15
15
|
export { default as AdminSideBar } from "./admin/Sidebar";
|
16
16
|
export { default as Dashboard } from "./admin/Dashboard";
|
17
17
|
export { registerApi, loginApi } from "./api/api";
|
18
|
+
|
19
|
+
export { default as UpdateUserDetails } from "./useraccount/UpdateUserDetails";
|
@@ -1,153 +0,0 @@
|
|
1
|
-
import React from "react";
|
2
|
-
import { useState, useEffect } from "react";
|
3
|
-
import { getProfileApi } from "../api/updateuser";
|
4
|
-
import Cookies from "universal-cookie";
|
5
|
-
|
6
|
-
interface AddMissingDetailsProps {
|
7
|
-
usermodalopen: boolean;
|
8
|
-
closeusermodal: () => void;
|
9
|
-
url: string;
|
10
|
-
isDarkMode: boolean;
|
11
|
-
}
|
12
|
-
interface UserProfile {
|
13
|
-
name: string;
|
14
|
-
mobile: string;
|
15
|
-
address: string;
|
16
|
-
}
|
17
|
-
|
18
|
-
const AddMissingDetails: React.FC<AddMissingDetailsProps> = ({
|
19
|
-
usermodalopen,
|
20
|
-
closeusermodal,
|
21
|
-
url,
|
22
|
-
isDarkMode,
|
23
|
-
}) => {
|
24
|
-
const [name, setName] = useState<string>("");
|
25
|
-
const [mobile, setMobile] = useState<string>("");
|
26
|
-
const [address, setAddress] = useState<string>("");
|
27
|
-
const [user, setUser] = useState<UserProfile | undefined>(undefined);
|
28
|
-
|
29
|
-
const cookies = new Cookies();
|
30
|
-
const token = cookies.get("authToken");
|
31
|
-
|
32
|
-
const userToken = token?.data?.token || token;
|
33
|
-
|
34
|
-
useEffect(() => {
|
35
|
-
const fetchUserProfile = async () => {
|
36
|
-
if (usermodalopen && userToken && !user) {
|
37
|
-
try {
|
38
|
-
const userProfile = await getProfileApi(userToken, url);
|
39
|
-
if (userProfile) {
|
40
|
-
setUser(userProfile);
|
41
|
-
setName(userProfile.name);
|
42
|
-
setMobile(userProfile.mobile);
|
43
|
-
setAddress(userProfile.address);
|
44
|
-
}
|
45
|
-
} catch (error) {
|
46
|
-
console.error("Error fetching user profile:", error);
|
47
|
-
}
|
48
|
-
}
|
49
|
-
};
|
50
|
-
|
51
|
-
fetchUserProfile();
|
52
|
-
}, [usermodalopen, userToken, user]);
|
53
|
-
|
54
|
-
return (
|
55
|
-
<div
|
56
|
-
className={`fixed inset-0 flex items-center justify-center ${
|
57
|
-
isDarkMode ? "bg-gray-800 bg-opacity-90" : "bg-gray-500 bg-opacity-75"
|
58
|
-
}`}
|
59
|
-
>
|
60
|
-
<div
|
61
|
-
className={`rounded-lg p-6 w-full max-w-md relative ${
|
62
|
-
isDarkMode
|
63
|
-
? "border border-gray-300 bg-[#242424] text-white"
|
64
|
-
: "bg-white text-black"
|
65
|
-
}`}
|
66
|
-
>
|
67
|
-
<button
|
68
|
-
onClick={closeusermodal}
|
69
|
-
className={`absolute top-3 right-3 ${
|
70
|
-
isDarkMode
|
71
|
-
? "text-gray-300 hover:text-gray-500"
|
72
|
-
: "text-gray-400 hover:text-gray-600"
|
73
|
-
} text-2xl`}
|
74
|
-
>
|
75
|
-
×
|
76
|
-
</button>
|
77
|
-
|
78
|
-
<h3 className="text-center text-xl font-bold mb-4">Add User Details</h3>
|
79
|
-
|
80
|
-
<div className="mb-4">
|
81
|
-
<label
|
82
|
-
className={`block text-sm font-medium mb-1 ${
|
83
|
-
isDarkMode ? "text-gray-300" : "text-gray-700"
|
84
|
-
}`}
|
85
|
-
>
|
86
|
-
Name
|
87
|
-
</label>
|
88
|
-
<input
|
89
|
-
type="text"
|
90
|
-
placeholder="Name"
|
91
|
-
className={`w-full p-2 border rounded focus:outline-none focus:ring ${
|
92
|
-
isDarkMode
|
93
|
-
? "bg-gray-800 border-gray-700 text-white "
|
94
|
-
: "border-gray-300 "
|
95
|
-
}`}
|
96
|
-
/>
|
97
|
-
</div>
|
98
|
-
|
99
|
-
<div className="mb-4">
|
100
|
-
<label
|
101
|
-
className={`block text-sm font-medium mb-1 ${
|
102
|
-
isDarkMode ? "text-gray-300" : "text-gray-700"
|
103
|
-
}`}
|
104
|
-
>
|
105
|
-
Mobile
|
106
|
-
</label>
|
107
|
-
<input
|
108
|
-
type="tel"
|
109
|
-
placeholder="Mobile"
|
110
|
-
className={`w-full p-2 border rounded focus:outline-none focus:ring ${
|
111
|
-
isDarkMode
|
112
|
-
? "bg-gray-800 border-gray-700 text-white "
|
113
|
-
: "border-gray-300 "
|
114
|
-
}`}
|
115
|
-
/>
|
116
|
-
</div>
|
117
|
-
|
118
|
-
<div className="mb-4">
|
119
|
-
<label
|
120
|
-
className={`block text-sm font-medium mb-1 ${
|
121
|
-
isDarkMode ? "text-gray-300" : "text-gray-700"
|
122
|
-
}`}
|
123
|
-
>
|
124
|
-
Address
|
125
|
-
</label>
|
126
|
-
<input
|
127
|
-
type="text"
|
128
|
-
placeholder="Address"
|
129
|
-
className={`w-full p-2 border rounded focus:outline-none focus:ring ${
|
130
|
-
isDarkMode
|
131
|
-
? "bg-gray-800 border-gray-700 text-white "
|
132
|
-
: "border-gray-300 "
|
133
|
-
}`}
|
134
|
-
/>
|
135
|
-
</div>
|
136
|
-
|
137
|
-
<div className="flex justify-end">
|
138
|
-
<button
|
139
|
-
className={`px-4 py-2 rounded ${
|
140
|
-
isDarkMode
|
141
|
-
? "bg-blue-500 hover:bg-blue-400 text-white"
|
142
|
-
: "bg-blue-500 hover:bg-blue-400 text-white"
|
143
|
-
}`}
|
144
|
-
>
|
145
|
-
Add Details
|
146
|
-
</button>
|
147
|
-
</div>
|
148
|
-
</div>
|
149
|
-
</div>
|
150
|
-
);
|
151
|
-
};
|
152
|
-
|
153
|
-
export default AddMissingDetails;
|