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
|
filename: string
|
||||||
) => {
|
) => {
|
||||||
const gist = await gistGrabber(gistId);
|
const gist = await gistGrabber(gistId);
|
||||||
if (gist?.files){
|
if (gist === null) return null;
|
||||||
const file = gist.files[filename];
|
if (!gist.files) return null;
|
||||||
return file
|
return gist.files[filename];
|
||||||
}
|
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get a Group of Gist files by ID
|
// Get a Group of Gist files by ID
|
||||||
|
|
Loading…
Reference in New Issue