diff --git a/src/api/userApi.ts b/src/api/userApi.ts index eaadc9e97..d076f1253 100644 --- a/src/api/userApi.ts +++ b/src/api/userApi.ts @@ -46,7 +46,6 @@ const updatePassword = () => { const getUsers = ( params: { searchName: string; - searchEmail: string; filterOutRoles?: Roles[]; nameSpaceSlug: string; canAssignUsers: boolean; diff --git a/src/components/PaginetedDataGrid.tsx b/src/components/PaginetedDataGrid.tsx index a28da052e..bb7f67394 100644 --- a/src/components/PaginetedDataGrid.tsx +++ b/src/components/PaginetedDataGrid.tsx @@ -1,4 +1,4 @@ -import { DataGrid } from "@mui/x-data-grid"; +import { DataGrid, GridToolbar } from "@mui/x-data-grid"; import React from "react"; const PaginatedDataGrid = ({ rows, columns, sx }) => { @@ -11,6 +11,18 @@ const PaginatedDataGrid = ({ rows, columns, sx }) => { { const { t } = useTranslation(); - const [loading, setLoading] = useState(false); - const [totalUsers, setTotalUsers] = useState(0); - const [filteredUsers, setFilteredUsers] = useState([]); - const [paginationModel, setPaginationModel] = useState({ - page: 0, - pageSize: 10, - }); - const [searchName, setSearchName] = useState(""); - const [searchEmail, setSearchEmail] = useState(""); - const [applyFilters, setApplyFilters] = useState(false); - const [isInitialLoad, setIsInitialLoad] = useState(true); function tabProps(index: number) { return { @@ -29,42 +16,6 @@ const AdminTabNavigator = ({ value, handleChange }) => { }; } - const fetchData = useCallback(async () => { - setLoading(true); - try { - const response = await userApi.getUsers( - { - searchName, - searchEmail, - nameSpaceSlug: "", - canAssignUsers: false, - }, - t - ); - if (response) { - setTotalUsers(response.total); - setFilteredUsers(response.data); - } - } catch (error) { - console.error("Error fetching users:", error); - } finally { - setLoading(false); - } - }, [ - paginationModel.page, - paginationModel.pageSize, - searchName, - searchEmail, - ]); - - useEffect(() => { - if (isInitialLoad || applyFilters) { - fetchData(); - if (isInitialLoad) setIsInitialLoad(false); - setApplyFilters(false); - } - }, [applyFilters, fetchData, isInitialLoad]); - return ( { {...tabProps(1)} /> - ); }; -export default AdminTabNavigator; +export default AdminTabNavigator; \ No newline at end of file