File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,24 @@ import Pagination from '@/app/ui/invoices/pagination';
2
2
import Search from '@/app/ui/search' ;
3
3
import Table from '@/app/ui/invoices/table' ;
4
4
import { CreateInvoice } from '@/app/ui/invoices/buttons' ;
5
+ import { fetchInvoicesPages } from '@/app/lib/data' ;
5
6
import { lusitana } from '@/app/ui/fonts' ;
6
7
import { InvoicesTableSkeleton } from '@/app/ui/skeletons' ;
7
8
import { Suspense } from 'react' ;
8
-
9
- export default async function Page ( ) {
9
+
10
+ export default async function Page ( {
11
+ searchParams,
12
+ } : {
13
+ searchParams ?: {
14
+ query ?: string ;
15
+ page ?: string ;
16
+ } ;
17
+ } ) {
18
+ const query = searchParams ?. query || '' ;
19
+ const currentPage = Number ( searchParams ?. page || 1 ) ;
20
+
21
+ const totalPages = await fetchInvoicesPages ( query ) ;
22
+
10
23
return (
11
24
< div className = "w-full" >
12
25
< div className = "flex w-full items-center justify-between" >
@@ -16,12 +29,12 @@ export default async function Page() {
16
29
< Search placeholder = "Search invoices..." />
17
30
< CreateInvoice />
18
31
</ div >
19
- { /* <Suspense key={query + currentPage} fallback={<InvoicesTableSkeleton />}>
32
+ < Suspense key = { query + currentPage } fallback = { < InvoicesTableSkeleton /> } >
20
33
< Table query = { query } currentPage = { currentPage } />
21
- </Suspense> */ }
34
+ </ Suspense >
22
35
< div className = "mt-5 flex w-full justify-center" >
23
- { /* <Pagination totalPages={totalPages} /> */ }
36
+ < Pagination totalPages = { totalPages } />
24
37
</ div >
25
38
</ div >
26
39
) ;
27
- }
40
+ }
You can’t perform that action at this time.
0 commit comments