File tree Expand file tree Collapse file tree 3 files changed +23
-15
lines changed
(admin-end)/dashboard/chat
components/chat/chat-list Expand file tree Collapse file tree 3 files changed +23
-15
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,12 @@ export default function AdminChatPage() {
16
16
17
17
const pager = usePager ( { } ) ;
18
18
19
- const { data, isLoading } = useSWR < IPagination < DashboardChatSession > > (
20
- `/dashboard/chat/sessions?page=${ pager . page } &limit=${ pager . limit } ` ,
21
- ( key : string ) => fetcher ( key ) . then ( ( res ) => res . json ( ) ) ,
19
+ const { data, isLoading } = useSWR <
20
+ IPagination < DashboardChatSession > ,
21
+ any ,
22
+ string
23
+ > ( `/dashboard/chat/sessions?page=${ pager . page } &limit=${ pager . limit } ` , ( key ) =>
24
+ fetcher ( key ) . then ( ( res ) => res . json ( ) ) ,
22
25
) ;
23
26
24
27
if ( isLoading ) {
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ export default function PricingPage() {
71
71
const { fetcher, setShowSideBar } = useStore ( ) ;
72
72
const [ currentCategoryIndex , setCurrentCategoryIndex ] = useState ( 0 ) ;
73
73
74
- const { data : categories , isLoading } = useSWR < ICategory [ ] > (
74
+ const { data : categories , isLoading } = useSWR < ICategory [ ] , any , string > (
75
75
'/product/all' ,
76
76
( url ) => fetcher ( url ) . then ( ( res ) => res . json ( ) ) ,
77
77
) ;
Original file line number Diff line number Diff line change @@ -78,17 +78,22 @@ export function ChatItem(props: {
78
78
export function ChatList ( ) {
79
79
const { fetcher, currentChatSessionId } = useStore ( ) ;
80
80
81
- const { data : sessions } = useSWR < ChatSession [ ] > ( '/chat/sessions' , ( url ) => {
82
- return fetcher ( url )
83
- . then ( ( res ) => res . json ( ) )
84
- . then ( ( res ) =>
85
- res . map ( ( session : ChatSession & { _count : { messages : number } } ) => ( {
86
- ...session ,
87
- messagesCount : session . _count . messages ,
88
- _count : undefined ,
89
- } ) ) ,
90
- ) ;
91
- } ) ;
81
+ const { data : sessions } = useSWR < ChatSession [ ] , any , string > (
82
+ '/chat/sessions' ,
83
+ ( url ) => {
84
+ return fetcher ( url )
85
+ . then ( ( res ) => res . json ( ) )
86
+ . then ( ( res ) =>
87
+ res . map (
88
+ ( session : ChatSession & { _count : { messages : number } } ) => ( {
89
+ ...session ,
90
+ messagesCount : session . _count . messages ,
91
+ _count : undefined ,
92
+ } ) ,
93
+ ) ,
94
+ ) ;
95
+ } ,
96
+ ) ;
92
97
93
98
return (
94
99
< div className = { styles [ 'chat-list' ] } >
You can’t perform that action at this time.
0 commit comments