Skip to content

Commit

Permalink
[admin] don't search all users initially
Browse files Browse the repository at this point in the history
  • Loading branch information
svenefftinge committed Oct 4, 2022
1 parent 83cb1c7 commit e51d829
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions components/dashboard/src/admin/UserSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ export default function UserSearch() {
const [currentUser, setCurrentUserState] = useState<User | undefined>(undefined);
const pageLength = 50;
const [currentPage, setCurrentPage] = useState(1);
useEffect(() => {
const updateCurrentPage = (page: number) => {
setCurrentPage(page);
search();
}, [currentPage]);
};

useEffect(() => {
const userId = location.pathname.split("/")[3];
Expand Down Expand Up @@ -111,7 +112,7 @@ export default function UserSearch() {
</div>
<Pagination
currentPage={currentPage}
setPage={setCurrentPage}
setPage={updateCurrentPage}
totalNumberOfPages={Math.ceil(searchResult.total / pageLength)}
/>
</PageWithAdminSubMenu>
Expand Down

0 comments on commit e51d829

Please sign in to comment.