@@ -5,7 +5,6 @@ import { Button } from "@/components/ui/button"
5
5
import { Skeleton } from "@/components/ui/skeleton"
6
6
import useApiClient from "@/hooks/use-api-client"
7
7
import useLocalStorage from "@/hooks/use-local-storage"
8
- import { fetchAdminQuotePending } from "@/lib/api"
9
8
import { useSuspenseQuery } from "@tanstack/react-query"
10
9
import { ViewIcon } from "lucide-react"
11
10
import { Suspense } from "react"
@@ -19,22 +18,26 @@ function Loader() {
19
18
}
20
19
21
20
function QuoteListPendingRaw ( ) {
21
+ const client = useApiClient ( )
22
+
22
23
const { data } = useSuspenseQuery ( {
23
24
queryKey : [ "quotes-pending" ] ,
24
- queryFn : fetchAdminQuotePending ,
25
+ queryFn : ( ) => client . listPendingQuotes ( ) ,
25
26
} )
26
27
27
28
return (
28
29
< >
29
- < pre className = "text-sm bg-accent text-accent-foreground rounded-lg p-2 my-2" >
30
- { JSON . stringify ( data , null , 2 ) }
31
- </ pre >
30
+ { data . data && (
31
+ < pre className = "text-sm bg-accent text-accent-foreground rounded-lg p-2 my-2" >
32
+ { JSON . stringify ( data . data , null , 2 ) }
33
+ </ pre >
34
+ ) }
32
35
</ >
33
36
)
34
37
}
35
38
36
39
function QuoteListPending ( ) {
37
- const client = useApiClient ( ) ;
40
+ const client = useApiClient ( )
38
41
39
42
const { data } = useSuspenseQuery ( {
40
43
queryKey : [ "quotes-pending" ] ,
@@ -44,16 +47,20 @@ function QuoteListPending() {
44
47
return (
45
48
< >
46
49
< div className = "flex flex-col gap-1" >
47
- { data . data ? data . data . quotes . map ( ( it , index ) => {
48
- return (
49
- < div key = { index } className = "flex gap-1 items-center text-sm" >
50
- < span > { it } </ span >
51
- < Button size = "sm" >
52
- < ViewIcon />
53
- </ Button >
54
- </ div >
55
- )
56
- } ) : ( < > </ > ) }
50
+ { data . data ? (
51
+ data . data . quotes . map ( ( it , index ) => {
52
+ return (
53
+ < div key = { index } className = "flex gap-1 items-center text-sm" >
54
+ < span > { it } </ span >
55
+ < Button size = "sm" >
56
+ < ViewIcon />
57
+ </ Button >
58
+ </ div >
59
+ )
60
+ } )
61
+ ) : (
62
+ < > </ >
63
+ ) }
57
64
</ div >
58
65
</ >
59
66
)
@@ -62,13 +69,7 @@ function QuoteListPending() {
62
69
function DevSection ( ) {
63
70
const [ devMode ] = useLocalStorage ( "devMode" , false )
64
71
65
- return (
66
- < >
67
- { devMode && (
68
- < QuoteListPendingRaw />
69
- ) }
70
- </ >
71
- )
72
+ return < > { devMode && < QuoteListPendingRaw /> } </ >
72
73
}
73
74
74
75
function PageBody ( ) {
0 commit comments