From ec3407df7ebd7380136e597a750d792eebf11b13 Mon Sep 17 00:00:00 2001 From: fadingNA Date: Wed, 6 Nov 2024 22:32:37 -0500 Subject: [PATCH] add 2 fiels for make request to api/combine --- frontend/src/api/services/userService.ts | 11 +++++++++-- frontend/src/preferences/preferenceApi.ts | 9 ++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/frontend/src/api/services/userService.ts b/frontend/src/api/services/userService.ts index 53b38f50..d55cc5bd 100644 --- a/frontend/src/api/services/userService.ts +++ b/frontend/src/api/services/userService.ts @@ -2,8 +2,15 @@ import apiClient from '../client'; import endpoints from '../endpoints'; const userService = { - getDocs: (sort = 'date', order = 'desc'): Promise => - apiClient.get(`${endpoints.USER.DOCS}?sort=${sort}&order=${order}`), + getDocs: ( + sort = 'date', + order = 'desc', + pageNumber = 1, + rowsPerPage = 10, + ): Promise => + apiClient.get( + `${endpoints.USER.DOCS}?sort=${sort}&order=${order}&page=${pageNumber}&rows=${rowsPerPage}`, + ), checkDocs: (data: any): Promise => apiClient.post(endpoints.USER.DOCS_CHECK, data), getAPIKeys: (): Promise => apiClient.get(endpoints.USER.API_KEYS), diff --git a/frontend/src/preferences/preferenceApi.ts b/frontend/src/preferences/preferenceApi.ts index af1060b8..226af119 100644 --- a/frontend/src/preferences/preferenceApi.ts +++ b/frontend/src/preferences/preferenceApi.ts @@ -6,9 +6,16 @@ import { Doc } from '../models/misc'; export async function getDocs( sort = 'date', order = 'desc', + pageNumber = 1, + rowsPerPage = 5, ): Promise { 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[] = [];