mirror of
https://github.com/Radiquum/AniX.git
synced 2025-05-03 19:39:39 +05:00
feat(next-page-loading): disable load more button when length of fetched page is less than 25 on all pages
This commit is contained in:
parent
f84c923ab7
commit
85302f0607
5 changed files with 58 additions and 13 deletions
|
@ -18,6 +18,8 @@ export default function Bookmarks() {
|
|||
const [releases, setReleases] = useState();
|
||||
const [page, setPage] = useState(0);
|
||||
|
||||
const [isNextPage, setIsNextPage] = useState(true);
|
||||
|
||||
const searchParams = useSearchParams();
|
||||
const createQueryString = useCallback(
|
||||
(name, value) => {
|
||||
|
@ -45,6 +47,12 @@ export default function Bookmarks() {
|
|||
const url = `${endpoints.user.bookmarks[list]}?page=${page}&token=${userStore.token}`;
|
||||
const data = await getData(url);
|
||||
|
||||
if (data.content.length < 25) {
|
||||
setIsNextPage(false);
|
||||
} else {
|
||||
setIsNextPage(true);
|
||||
}
|
||||
|
||||
// Handle initial load (page 0) or subsequent pagination
|
||||
if (page === 0) {
|
||||
setReleases(data.content);
|
||||
|
@ -106,6 +114,7 @@ export default function Bookmarks() {
|
|||
setPage={setPage}
|
||||
list={list}
|
||||
releases={releases}
|
||||
isNextPage={isNextPage}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue