Refactor getGistFile function to handle null and missing files
This commit is contained in:
parent
ed1b33b32a
commit
ac0732423a
|
@ -99,11 +99,9 @@ export const getGistFile = async (
|
|||
filename: string
|
||||
) => {
|
||||
const gist = await gistGrabber(gistId);
|
||||
if (gist?.files){
|
||||
const file = gist.files[filename];
|
||||
return file
|
||||
}
|
||||
return null;
|
||||
if (gist === null) return null;
|
||||
if (!gist.files) return null;
|
||||
return gist.files[filename];
|
||||
};
|
||||
|
||||
// Get a Group of Gist files by ID
|
||||
|
|
Loading…
Reference in New Issue