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 { TableProps } from 'antd/lib';
|
||||||
import { UserService } from '@/services/userService';
|
import { UserService } from '@/services/userService';
|
||||||
import UserEdit from '@/components/UserEdit';
|
import UserEdit from '@/components/UserEdit';
|
||||||
|
import { useSearchParams } from 'react-router-dom';
|
||||||
|
|
||||||
export default function AccountsPage() {
|
export default function AccountsPage() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [openCreate, setOpenCreate] = useState(false);
|
const [openCreate, setOpenCreate] = useState(false);
|
||||||
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
|
|
||||||
const [activeAccount, setActiveAccount] = useState<
|
const [activeAccount, setActiveAccount] = useState<
|
||||||
{ login: string; id: number; name: string; email: string } | undefined
|
{ login: string; id: number; name: string; email: string } | undefined
|
||||||
@ -42,6 +44,10 @@ export default function AccountsPage() {
|
|||||||
async function getUsers() {
|
async function getUsers() {
|
||||||
const data = await UserService.getUsers();
|
const data = await UserService.getUsers();
|
||||||
setAccounts(data);
|
setAccounts(data);
|
||||||
|
setSearchParams({
|
||||||
|
page: data.currentPage.toString(),
|
||||||
|
limit: data.limit.toString(),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getUsers();
|
getUsers();
|
||||||
@ -152,6 +158,10 @@ export default function AccountsPage() {
|
|||||||
pagination.pageSize
|
pagination.pageSize
|
||||||
).then((data) => {
|
).then((data) => {
|
||||||
setAccounts(data);
|
setAccounts(data);
|
||||||
|
setSearchParams({
|
||||||
|
page: data.currentPage.toString(),
|
||||||
|
limit: data.limit.toString(),
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user