added admin controllerwhere admin can delete user id#99
added admin controllerwhere admin can delete user id#99Dynamic-Aryan wants to merge 8 commits intoalvarotorrestx:devfrom
Conversation
alvarotorrestx
left a comment
There was a problem hiding this comment.
Overall, great job.
I can see where you are going with this and it's going well!
Further feedback to where I can't comment on in the actual code:
- I can access the adminpage as a normal user by going to /adminpage
- This needs to be resolved in the backend
I know you said there's more features to come so I'm excited to see where that goes! Can't wait to see it.
Please let me know if you need help in the Discord channel! 😄
| import { HiNewspaper } from "react-icons/hi2"; | ||
| import { IoMdPeople } from "react-icons/io"; | ||
| import { GiSuitcase } from "react-icons/gi"; | ||
| import { GiAbstract021, GiSuitcase } from "react-icons/gi"; |
There was a problem hiding this comment.
Not the biggest fan of the Icon, but not a priority. Perhaps a config, controller, debug or something similar icon might suffice.
| import useAuth from "../../../auth/useAuth"; | ||
| import { axiosPrivate } from "../../../api/axios"; |
There was a problem hiding this comment.
Layout.jsx is already sharing auth with the NavBar, passing as a prop.
This would be redundant code.
| useEffect(() => { | ||
| const fetchUsers = async () => { | ||
| setLoading(true); | ||
| try { | ||
| const response = await axiosPrivate.get("/api/users", { | ||
| headers: { | ||
| Authorization: `Bearer ${auth?.accessToken}`, | ||
| }, | ||
| }); | ||
| setUsers(response.data); | ||
| } catch (err) { | ||
| console.log(err); | ||
| } finally { | ||
| setLoading(false); | ||
| } |
There was a problem hiding this comment.
Although, I do see why you did this, but I would prefer for this to be a separate call inside your admin page as you did. Not needed to be ran within the navbar.
| {(auth?.role === "admin" || auth?.role === "user") && ( | ||
| <li> | ||
| <NavLink to="/adminpage" className="flex items-center"> | ||
| <span className="text-2xl text-primary"> | ||
| <GiSuitcase /> | ||
| </span> | ||
| Adminarea | ||
| </NavLink> |
There was a problem hiding this comment.
role of "user" should not be able to access this page
Also the icon isn't matching the desktop one.
| <button | ||
| onClick={() => setShowModal(false)} | ||
| className="px-4 py-2 bg-gray-200 rounded hover:bg-gray-300" | ||
| > | ||
| Cancel | ||
| </button> |
There was a problem hiding this comment.
Button is hard to read in dark theme
|
Did all changes as per your requirement ,,please check again and sorry for this small mistakes which i made ,,but i resolved those all,, latest pr is raised, please check it ,,and still working on new things to be added ,,and resolve the current issues |
alvarotorrestx
left a comment
There was a problem hiding this comment.
Will talk to you on Discord to realign
client/src/App.jsx
Outdated
| import Network from './assets/components/network/Network'; | ||
| import Adminpage from './assets/components/Admin/Adminpage'; | ||
| import Usersprofile from './assets/components/Admin/Usersprofile'; | ||
| import EditUsersprofile from './assets/components/Admin/EditUsersprofile'; |
There was a problem hiding this comment.
This is redundant as well, the EditProfile page currently knows when the User or an Admin/Owner roles are viewing and will allow changes to happen. This seems to be a duplicate of Edit Profile and does not need to be added.
Furthermore, EditProfile is also being redesigned by another contribute in issue #86
Please remove this.
client/src/App.jsx
Outdated
| <Route path="/admin/profile/:username" element={<ProfileProvider />} > | ||
| <Route index element={<Usersprofile />} /> | ||
| <Route path="editbyadmin" element={<EditUsersprofile/>}/> |
There was a problem hiding this comment.
Can be removed as mentioned earlier
There was a problem hiding this comment.
Can be removed as mentioned earlier
There was a problem hiding this comment.
Can be removed as mentioned earlier
|
@Dynamic-Aryan Great work on this! It's come out really well and you've followed requests persistently. Thanks so much for this. Keep continuing to work on this. Keep making the theme match accordingly. I love the role colors, and a lot of the input fields, etc. Just keep working on matching and as well add more logic. Ensure certain roles can only edit other certain roles such as: Keep coming up with features for this. Great work! 😀 |
Here as i created one path for admin and owner ,like where this both can delete the existing user by their ID ,,this is how ,,when the admin or owner will login to website , their in navbar their are 5 components for them ,,the 5th one is likely for them ,from where they will navigate to page and can delete the user , furthermore new changes will be added to it ,Thank you!!