user dashboard pagination bug removed
This commit is contained in:
parent
115607cb6b
commit
d577a21a9a
|
@ -116,8 +116,19 @@ export default function Users() {
|
||||||
if (data?._users) {
|
if (data?._users) {
|
||||||
const { pagination, users } = data._users;
|
const { pagination, users } = data._users;
|
||||||
const maxPages = getMaxPages(pagination);
|
const maxPages = getMaxPages(pagination);
|
||||||
setPaginationProps({ ...paginationProps, ...pagination, maxPages });
|
if (users && users.length > 0) {
|
||||||
setUserList(users);
|
setPaginationProps({ ...paginationProps, ...pagination, maxPages });
|
||||||
|
setUserList(users);
|
||||||
|
} else {
|
||||||
|
if (paginationProps.page !== 1) {
|
||||||
|
setPaginationProps({
|
||||||
|
...paginationProps,
|
||||||
|
...pagination,
|
||||||
|
maxPages,
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
@ -230,7 +241,7 @@ export default function Users() {
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</Tbody>
|
</Tbody>
|
||||||
{paginationProps.maxPages > 1 && (
|
{(paginationProps.maxPages > 1 || paginationProps.total >= 5) && (
|
||||||
<TableCaption>
|
<TableCaption>
|
||||||
<Flex
|
<Flex
|
||||||
justifyContent="space-between"
|
justifyContent="space-between"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user