(feat:docs) sort

This commit is contained in:
ManishMadan2882
2024-11-05 00:44:02 +05:30
parent dbfc1bb68f
commit 877b165a9a
4 changed files with 40 additions and 9 deletions

View File

@@ -3,9 +3,12 @@ import userService from '../api/services/userService';
import { Doc } 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(): Promise<Doc[] | null> {
export async function getDocs(
sort = 'date',
order = 'desc',
): Promise<Doc[] | null> {
try {
const response = await userService.getDocs();
const response = await userService.getDocs(sort, order);
const data = await response.json();
const docs: Doc[] = [];