From aae56a8c736e365fd58968525e1d42ea66833768 Mon Sep 17 00:00:00 2001 From: Vladislav Syrochkin Date: Tue, 24 Jun 2025 13:18:45 +0500 Subject: [PATCH] feat(AccountsPage): add on table change --- Makefile | 2 +- client/src/pages/AccountsPage.tsx | 15 ++++++++++++++- client/src/types/openapi-types.ts | 2 ++ client/src/types/user.ts | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3f4dab6..241334c 100644 --- a/Makefile +++ b/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 diff --git a/client/src/pages/AccountsPage.tsx b/client/src/pages/AccountsPage.tsx index aa67ac7..f94ad6c 100644 --- a/client/src/pages/AccountsPage.tsx +++ b/client/src/pages/AccountsPage.tsx @@ -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['onChange'] = (pagination) => { + console.log(pagination); + UserService.getUsers(pagination.current as number, 10).then((data) => { + setAccounts(data); + }); + }; + return ( <>
diff --git a/client/src/types/openapi-types.ts b/client/src/types/openapi-types.ts index b23e43f..1e14c6c 100644 --- a/client/src/types/openapi-types.ts +++ b/client/src/types/openapi-types.ts @@ -191,6 +191,8 @@ export interface components { amountCount: number; /** Amountpages */ amountPages: number; + /** Currentpage */ + currentPage: number; }; /** Auth */ Auth: { diff --git a/client/src/types/user.ts b/client/src/types/user.ts index 0c20246..ef49e4a 100644 --- a/client/src/types/user.ts +++ b/client/src/types/user.ts @@ -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'];