From f3a005a66753149cc80e5adc95bdc7cfe0975b6a Mon Sep 17 00:00:00 2001 From: fadingNA Date: Sat, 9 Nov 2024 14:57:30 -0500 Subject: [PATCH] remove params on getDocs --- frontend/src/api/services/userService.ts | 3 +-- frontend/src/preferences/preferenceApi.ts | 7 ++----- frontend/src/settings/Documents.tsx | 3 +-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/frontend/src/api/services/userService.ts b/frontend/src/api/services/userService.ts index 82f32244..942318ae 100644 --- a/frontend/src/api/services/userService.ts +++ b/frontend/src/api/services/userService.ts @@ -2,8 +2,7 @@ import apiClient from '../client'; import endpoints from '../endpoints'; const userService = { - getDocs: (sort: string, order: string): Promise => - apiClient.get(`${endpoints.USER.DOCS}?sort=${sort}&order=${order}`), + getDocs: (): Promise => apiClient.get(`${endpoints.USER.DOCS}`), getDocsWithPagination: (query: string): Promise => apiClient.get(`${endpoints.USER.DOCS_PAGINATED}?${query}`), checkDocs: (data: any): Promise => diff --git a/frontend/src/preferences/preferenceApi.ts b/frontend/src/preferences/preferenceApi.ts index e3d22c02..c1ac97de 100644 --- a/frontend/src/preferences/preferenceApi.ts +++ b/frontend/src/preferences/preferenceApi.ts @@ -3,12 +3,9 @@ import userService from '../api/services/userService'; import { Doc, GetDocsResponse } from '../models/misc'; //Fetches all JSON objects from the source. We only use the objects with the "model" property in SelectDocsModal.tsx. Hopefully can clean up the source file later. -export async function getDocs( - sort = 'date', - order = 'desc', -): Promise { +export async function getDocs(): Promise { try { - const response = await userService.getDocs(sort, order); + const response = await userService.getDocs(); const data = await response.json(); const docs: Doc[] = []; diff --git a/frontend/src/settings/Documents.tsx b/frontend/src/settings/Documents.tsx index 8a35ca7d..70cc86ba 100644 --- a/frontend/src/settings/Documents.tsx +++ b/frontend/src/settings/Documents.tsx @@ -83,8 +83,7 @@ const Documents: React.FC = ({ handleDeleteDocument }) => { } getDocsWithPagination(sortField, sortOrder, page, rowsPerPg) .then((data) => { - console.log('Data received from getDocsWithPagination:', data); - dispatch(setSourceDocs(data ? data.docs : [])); + //dispatch(setSourceDocs(data ? data.docs : [])); setFetchedDocuments(data ? data.docs : []); setTotalPages(data ? data.totalPages : 0); setTotalDocuments(data ? data.totalDocuments : 0);