diff --git a/tubearchivist/www/src/lib/getDownloads.ts b/tubearchivist/www/src/lib/getDownloads.ts index 68ba5cd..03286b5 100755 --- a/tubearchivist/www/src/lib/getDownloads.ts +++ b/tubearchivist/www/src/lib/getDownloads.ts @@ -3,8 +3,8 @@ import { getTAUrl } from "./constants"; const TA_BASE_URL = getTAUrl(); -export const getDownloads = async (token: string, filter: boolean): Promise => { - const response = await fetch(`${TA_BASE_URL.server}/api/download/?filter=${filter ? 'ignore' : 'pending'}`, { +export const getDownloads = async (token: string, filter: boolean, page: number): Promise => { + const response = await fetch(`${TA_BASE_URL.server}/api/download/?filter=${filter ? 'ignore' : 'pending'}&page=${page}`, { headers: { Accept: "application/json", "Content-Type": "application/json", @@ -12,10 +12,19 @@ export const getDownloads = async (token: string, filter: boolean): Promise => { diff --git a/tubearchivist/www/src/pages/download.tsx b/tubearchivist/www/src/pages/download.tsx index c91141c..44bc707 100755 --- a/tubearchivist/www/src/pages/download.tsx +++ b/tubearchivist/www/src/pages/download.tsx @@ -40,7 +40,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => { } await queryClient.prefetchQuery(["downloads", session.ta_token.token, false], () => - getDownloads(session.ta_token.token, false) + getDownloads(session.ta_token.token, false, 1) ); return { @@ -64,7 +64,7 @@ const Download: NextPage = () => { refetch, } = useQuery( ["downloads", session.ta_token.token, ignoredStatus], - () => getDownloads(session.ta_token.token, ignoredStatus), + () => getDownloads(session.ta_token.token, ignoredStatus, page), { enabled: !!session?.ta_token?.token, refetchInterval: 1500, @@ -116,6 +116,12 @@ const Download: NextPage = () => {

Downloads

+ {downloads?.message && +
+

{downloads?.message}

+

+
+ } {errorMessage &&

Failed to extract links.

@@ -268,9 +274,9 @@ const Download: NextPage = () => {
} -

Total videos: {downloads?.data?.length} {!downloads?.data?.length && !ignoredStatus &&

No videos queued for download. Press rescan subscriptions to check if there are any new videos.

}

+

Total videos: {downloads?.data?.length ? downloads?.data?.length : 'N/A'} {!downloads?.data?.length && !downloads?.message && !ignoredStatus &&

No videos queued for download. Press rescan subscriptions to check if there are any new videos.

}

- {!isLoading && !error && downloads?.data && + {!isLoading && !error && !downloads?.message && downloads?.data?.map((video) => { return (
@@ -350,7 +356,6 @@ const Download: NextPage = () => { {/*
*/} {/* {% endfor %} */} {/* {% endif %} */} -