forked from arc53/DocsGPT
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from TaylorS15/taylor-working
review changes
- Loading branch information
Showing
6 changed files
with
60 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//Exporting Doc type from here since its the first place its used and seems needless to make an entire file for it. | ||
export type Doc = { | ||
name: string; | ||
language: string; | ||
version: string; | ||
description: string; | ||
fullName: string; | ||
dat: string; | ||
docLink: string; | ||
model: string; | ||
}; | ||
|
||
//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> { | ||
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: Doc[] = []; | ||
|
||
data.forEach((doc: Doc) => { | ||
docs.push(doc); | ||
}); | ||
|
||
return docs; | ||
} catch (error) { | ||
return null; | ||
} | ||
} |