Procházet zdrojové kódy

♻️ refactor(contracts): adjust state declaration order

- move dataSource and pagination state declarations above fetchContracts function
- maintain same functionality while improving code readability through logical ordering
yourname před 8 měsíci
rodič
revize
a332e8012e
1 změnil soubory, kde provedl 7 přidání a 7 odebrání
  1. 7 7
      src/client/admin/pages/Contracts.tsx

+ 7 - 7
src/client/admin/pages/Contracts.tsx

@@ -32,6 +32,13 @@ const Contracts: React.FC = () => {
     },
   });
   
+  const [dataSource, setDataSource] = useState<HetongItem[]>([]);
+  const [pagination, setPagination] = useState({
+    current: 1,
+    pageSize: 10,
+    total: 0,
+  });
+  
   // 获取合同列表数据
   const fetchContracts = async ({ page, pageSize }: { page: number; pageSize: number }): Promise<HetongListResponse> => {
     const response = await hetongClient.$get({ query: { page, pageSize, keyword: searchText } });
@@ -51,13 +58,6 @@ const Contracts: React.FC = () => {
     },
   });
   
-  const [dataSource, setDataSource] = useState<HetongItem[]>([]);
-  const [pagination, setPagination] = useState({
-    current: 1,
-    pageSize: 10,
-    total: 0,
-  });
-  
   // 搜索
   const handleSearch = () => {
     setPagination({ ...pagination, current: 1 });