Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
feat: admin user management page added
Browse files Browse the repository at this point in the history
  • Loading branch information
amarnath-dev committed Mar 9, 2024
1 parent 9ec6334 commit aa9ccf1
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions client/src/pages/AdminPages/Managment/Managment.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
import { useState } from "react";
import { useEffect, useState } from "react";
import CheckReport from "../../../components/CheckReport/CheckReport";
import { getUsers } from "../../../Services/userService";
import { blockUser } from "../../../Services/userService";
import { toast } from "react-toastify";

function Managment() {
const [openModal, setOpenModal] = useState(false);
const [reportObject, setReportObject] = useState();

const [users, setUsers] = useState([]);

const handleModal = () => {
setOpenModal(true);
};
useEffect(() => {
const fetchUsers = async () => {
const response = await getUsers();
if (response.success === true) {
setUsers(response.users);
}
};
fetchUsers();
}, []);

const handleBlock = async (userId) => {
const response = await blockUser(userId);
if (response.success === true) {
toast(response.message);
}
};

return (
<>
<CheckReport
Expand Down Expand Up @@ -56,7 +79,10 @@ function Managment() {
</button>
</td>
<td className="px-6 py-4">
<button className="border py-1 px-6 rounded hover:bg-red-700">
<button
className="border py-1 px-6 rounded hover:bg-red-700"
onClick={() => handleBlock(user?._id)}
>
Block
</button>
</td>
Expand Down

0 comments on commit aa9ccf1

Please sign in to comment.