add 2 fiels for make request to api/combine

This commit is contained in:
fadingNA
2024-11-06 22:32:37 -05:00
parent 5dae074c95
commit ec3407df7e
2 changed files with 17 additions and 3 deletions

View File

@@ -2,8 +2,15 @@ import apiClient from '../client';
import endpoints from '../endpoints';
const userService = {
getDocs: (sort = 'date', order = 'desc'): Promise<any> =>
apiClient.get(`${endpoints.USER.DOCS}?sort=${sort}&order=${order}`),
getDocs: (
sort = 'date',
order = 'desc',
pageNumber = 1,
rowsPerPage = 10,
): Promise<any> =>
apiClient.get(
`${endpoints.USER.DOCS}?sort=${sort}&order=${order}&page=${pageNumber}&rows=${rowsPerPage}`,
),
checkDocs: (data: any): Promise<any> =>
apiClient.post(endpoints.USER.DOCS_CHECK, data),
getAPIKeys: (): Promise<any> => apiClient.get(endpoints.USER.API_KEYS),

View File

@@ -6,9 +6,16 @@ import { Doc } from '../models/misc';
export async function getDocs(
sort = 'date',
order = 'desc',
pageNumber = 1,
rowsPerPage = 5,
): Promise<Doc[] | null> {
try {
const response = await userService.getDocs(sort, order);
const response = await userService.getDocs(
sort,
order,
pageNumber,
rowsPerPage,
);
const data = await response.json();
const docs: Doc[] = [];