mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 08:33:20 +00:00
23 lines
493 B
TypeScript
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;
|
|
}
|
|
}
|