Corrected hasMore functionality

This commit is contained in:
Luke Hagar
2022-07-31 22:24:26 -05:00
parent c0f0f4c217
commit 062017ae97
2 changed files with 6 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "plex-api-oauth",
"version": "1.1.98",
"version": "1.1.103",
"description": "An NPM Module designed to make Plex Media Server and plex.tv API calls easier to implement in JavaScript and React projects",
"main": "./src/index.js",
"type": "module",

View File

@@ -2,7 +2,6 @@ import { PlexOauth } from "plex-oauth";
import { v4 } from "uuid";
import axios from "axios";
import qs from "qs";
// import InfiniteScroll from "react-infinite-scroller";
import { useState, useEffect } from "react";
export async function PlexLogin(plexClientInformation) {
@@ -865,10 +864,13 @@ export async function GetLibraryPages(
break;
}
console.debug(data);
if (data !== null) {
try {
items = data;
hasMore = data.length > 0;
hasMore = data.length === chunkSize;
console.debug({ items, hasMore });
} catch {
items = [];
hasMore = false;
}
return { items, hasMore };
}