diff --git a/src/app/components/post-list/index.tsx b/src/app/components/post-list/index.tsx index db65bb96..5f89d8c4 100644 --- a/src/app/components/post-list/index.tsx +++ b/src/app/components/post-list/index.tsx @@ -31,32 +31,33 @@ const PostList = ({ const [search, setSearchValue] = useState("") const [posts, setPosts] = useState(initialPosts) const [searching, setSearching] = useState(false) - const [hasMorePosts, setHasMorePosts] = useState(morePosts) + const [hasMorePosts] = useState(morePosts) const { setToast } = useToasts() const loadMoreClick = useCallback( (e: React.MouseEvent) => { e.preventDefault() if (hasMorePosts) { + // eslint-disable-next-line no-inner-declarations async function fetchPosts() { - const res = await fetch(`/server-api/posts/mine`, { - method: "GET", - headers: { - "Content-Type": "application/json", - "x-page": `${posts.length / 10 + 1}` - }, - next: { - revalidate: 10 - } - }) - const json = await res.json() - setPosts([...posts, ...json.posts]) - setHasMorePosts(json.morePosts) + // const res = await fetch(`/api/posts/mine`, { + // method: "GET", + // headers: { + // "Content-Type": "application/json", + // "x-page": `${posts.length / 10 + 1}` + // }, + // next: { + // revalidate: 10 + // } + // }) + // const json = await res.json() + // setPosts([...posts, ...json.posts]) + // setHasMorePosts(json.morePosts) } fetchPosts() } }, - [posts, hasMorePosts] + [hasMorePosts] ) // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: address this