Files
DocsGPT/frontend/src/api/docs.ts
TaylorS15 80ada47df8 fix
2023-02-19 19:49:21 -05:00

23 lines
493 B
TypeScript

import { Doc } from '../models/misc';
export async function getDocs(): Promise<Doc[] | null> {
try {
//Fetch default source docs
const response = await fetch(
'https://d3dg1063dc54p9.cloudfront.net/combined.json',
);
const data = await response.json();
//Create array of Doc objects
const docs: Array<Doc> = [];
data.forEach((doc: Doc) => {
docs.push(doc);
});
return docs;
} catch (error) {
return null;
}
}