Refac APIClient to return data, error and status as object

This commit is contained in:
MerlinScheurer
2025-03-20 20:30:08 +01:00
parent 52083e6fb7
commit edcede5de6
67 changed files with 660 additions and 544 deletions

View File

@@ -1,11 +1,7 @@
import APIClient from '../../functions/APIClient';
import { DownloadResponseType } from '../../pages/Download';
const loadDownloadQueue = async (
page: number,
channelId: string | null,
showIgnored: boolean,
): Promise<DownloadResponseType> => {
const loadDownloadQueue = async (page: number, channelId: string | null, showIgnored: boolean) => {
const searchParams = new URLSearchParams();
if (page) searchParams.append('page', page.toString());
@@ -14,7 +10,7 @@ const loadDownloadQueue = async (
const endpoint = `/api/download/${searchParams.toString() ? `?${searchParams.toString()}` : ''}`;
return APIClient(endpoint);
return APIClient<DownloadResponseType>(endpoint);
};
export default loadDownloadQueue;