Skip to content

Commit

Permalink
fix: fix few any implicit
Browse files Browse the repository at this point in the history
  • Loading branch information
AprilNEA committed Dec 12, 2023
1 parent 4a8012b commit a04c98a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
9 changes: 6 additions & 3 deletions packages/frontend/src/app/(admin-end)/dashboard/chat/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ export default function AdminChatPage() {

const pager = usePager({});

const { data, isLoading } = useSWR<IPagination<DashboardChatSession>>(
`/dashboard/chat/sessions?page=${pager.page}&limit=${pager.limit}`,
(key: string) => fetcher(key).then((res) => res.json()),
const { data, isLoading } = useSWR<
IPagination<DashboardChatSession>,
any,
string
>(`/dashboard/chat/sessions?page=${pager.page}&limit=${pager.limit}`, (key) =>
fetcher(key).then((res) => res.json()),
);

if (isLoading) {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/app/(user-end)/premium/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function PricingPage() {
const { fetcher, setShowSideBar } = useStore();
const [currentCategoryIndex, setCurrentCategoryIndex] = useState(0);

const { data: categories, isLoading } = useSWR<ICategory[]>(
const { data: categories, isLoading } = useSWR<ICategory[], any, string>(
'/product/all',
(url) => fetcher(url).then((res) => res.json()),
);
Expand Down
27 changes: 16 additions & 11 deletions packages/frontend/src/components/chat/chat-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,22 @@ export function ChatItem(props: {
export function ChatList() {
const { fetcher, currentChatSessionId } = useStore();

const { data: sessions } = useSWR<ChatSession[]>('/chat/sessions', (url) => {
return fetcher(url)
.then((res) => res.json())
.then((res) =>
res.map((session: ChatSession & { _count: { messages: number } }) => ({
...session,
messagesCount: session._count.messages,
_count: undefined,
})),
);
});
const { data: sessions } = useSWR<ChatSession[], any, string>(
'/chat/sessions',
(url) => {
return fetcher(url)
.then((res) => res.json())
.then((res) =>
res.map(
(session: ChatSession & { _count: { messages: number } }) => ({
...session,
messagesCount: session._count.messages,
_count: undefined,
}),
),
);
},
);

return (
<div className={styles['chat-list']}>
Expand Down

0 comments on commit a04c98a

Please sign in to comment.