feat: enhance stays with api data
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
"use client"
|
||||
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { _ } from "@/lib/translation"
|
||||
import { trpc } from "@/lib/trpc/client"
|
||||
|
||||
@@ -12,7 +11,7 @@ import StayList from "../StayList"
|
||||
import EmptyUpcomingStaysBlock from "./EmptyUpcomingStays"
|
||||
|
||||
import { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
|
||||
import type { Page } from "@/types/components/myPages/myStays/page"
|
||||
import type { Page } from "@/types/components/myPages/stays/page"
|
||||
|
||||
export default function UpcomingStays({
|
||||
lang,
|
||||
@@ -22,14 +21,16 @@ export default function UpcomingStays({
|
||||
}: AccountPageComponentProps) {
|
||||
const { data, hasNextPage, isFetching, fetchNextPage } =
|
||||
trpc.user.stays.upcoming.useInfiniteQuery(
|
||||
{},
|
||||
{ limit: 6 },
|
||||
{
|
||||
getNextPageParam: (lastPage: Page) => lastPage.nextCursor,
|
||||
}
|
||||
)
|
||||
|
||||
function loadMoreData() {
|
||||
fetchNextPage()
|
||||
if (hasNextPage) {
|
||||
fetchNextPage()
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user