feat(AccountsPage): add page and limit to search params
This commit is contained in:
parent
ad0a4837fc
commit
ba65f36696
@ -8,10 +8,12 @@ import { Avatar, Table } from 'antd';
|
||||
import { TableProps } from 'antd/lib';
|
||||
import { UserService } from '@/services/userService';
|
||||
import UserEdit from '@/components/UserEdit';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
|
||||
export default function AccountsPage() {
|
||||
const { t } = useTranslation();
|
||||
const [openCreate, setOpenCreate] = useState(false);
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
|
||||
const [activeAccount, setActiveAccount] = useState<
|
||||
{ login: string; id: number; name: string; email: string } | undefined
|
||||
@ -42,6 +44,10 @@ export default function AccountsPage() {
|
||||
async function getUsers() {
|
||||
const data = await UserService.getUsers();
|
||||
setAccounts(data);
|
||||
setSearchParams({
|
||||
page: data.currentPage.toString(),
|
||||
limit: data.limit.toString(),
|
||||
});
|
||||
}
|
||||
|
||||
getUsers();
|
||||
@ -152,6 +158,10 @@ export default function AccountsPage() {
|
||||
pagination.pageSize
|
||||
).then((data) => {
|
||||
setAccounts(data);
|
||||
setSearchParams({
|
||||
page: data.currentPage.toString(),
|
||||
limit: data.limit.toString(),
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user