feat(AccountsPage): add on table change
This commit is contained in:
parent
7c2c4071cc
commit
aae56a8c73
2
Makefile
2
Makefile
@ -64,5 +64,5 @@ check-api:
|
||||
poetry run ruff format . --check
|
||||
|
||||
regenerate-openapi-local:
|
||||
rm client/src/types/openapi-types.types \
|
||||
rm client/src/types/openapi-types.ts \
|
||||
npx openapi-typescript http://localhost:8000/openapi -o client/src/types/openapi-types.ts
|
||||
|
@ -19,6 +19,7 @@ export default function AccountsPage() {
|
||||
amountCount: 0,
|
||||
amountPages: 0,
|
||||
users: [],
|
||||
currentPage: 1,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
@ -103,6 +104,13 @@ export default function AccountsPage() {
|
||||
},
|
||||
];
|
||||
|
||||
const onTableChange: TableProps<AllUser>['onChange'] = (pagination) => {
|
||||
console.log(pagination);
|
||||
UserService.getUsers(pagination.current as number, 10).then((data) => {
|
||||
setAccounts(data);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header
|
||||
@ -121,9 +129,14 @@ export default function AccountsPage() {
|
||||
}
|
||||
/>
|
||||
<Table
|
||||
onChange={onTableChange}
|
||||
columns={columns}
|
||||
dataSource={accounts.users}
|
||||
pagination={{ pageSize: 10, current: 1, total: accounts.amountCount }}
|
||||
pagination={{
|
||||
pageSize: 10,
|
||||
current: accounts.currentPage,
|
||||
total: accounts.amountCount,
|
||||
}}
|
||||
rowKey={'id'}
|
||||
/>
|
||||
|
||||
|
@ -191,6 +191,8 @@ export interface components {
|
||||
amountCount: number;
|
||||
/** Amountpages */
|
||||
amountPages: number;
|
||||
/** Currentpage */
|
||||
currentPage: number;
|
||||
};
|
||||
/** Auth */
|
||||
Auth: {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { components } from './openapi-types';
|
||||
import { components } from "./openapi-types";
|
||||
|
||||
export type User = components['schemas']['User'];
|
||||
export type AllUserResponse = components['schemas']['AllUserResponse'];
|
||||
|
Loading…
Reference in New Issue
Block a user