mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-30 09:03:15 +00:00
remove params on getDocs
This commit is contained in:
@@ -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> =>
|
||||
|
||||
@@ -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[] = [];
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user