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", "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", "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", "main": "./src/index.js",
"type": "module", "type": "module",

View File

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