remove params on getDocs

This commit is contained in:
fadingNA
2024-11-09 14:57:30 -05:00
parent d59ffaf0bd
commit f3a005a667
3 changed files with 4 additions and 9 deletions

View File

@@ -2,8 +2,7 @@ import apiClient from '../client';
import endpoints from '../endpoints';
const userService = {
getDocs: (sort: string, order: string): Promise<any> =>
apiClient.get(`${endpoints.USER.DOCS}?sort=${sort}&order=${order}`),
getDocs: (): Promise<any> => apiClient.get(`${endpoints.USER.DOCS}`),
getDocsWithPagination: (query: string): Promise<any> =>
apiClient.get(`${endpoints.USER.DOCS_PAGINATED}?${query}`),
checkDocs: (data: any): Promise<any> =>

View File

@@ -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<Doc[] | null> {
export async function getDocs(): Promise<Doc[] | null> {
try {
const response = await userService.getDocs(sort, order);
const response = await userService.getDocs();
const data = await response.json();
const docs: Doc[] = [];

View File

@@ -83,8 +83,7 @@ const Documents: React.FC<DocumentsProps> = ({ 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);