From aa6225178031a6f6b856c7e89fd20819ec5be4ff Mon Sep 17 00:00:00 2001 From: muzam1l Date: Fri, 12 Aug 2022 15:32:53 +0530 Subject: [PATCH] Fix gist name. --- components/Navigation.tsx | 2 +- state/actions/fetchFiles.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/components/Navigation.tsx b/components/Navigation.tsx index dfa24f1..972bfb2 100644 --- a/components/Navigation.tsx +++ b/components/Navigation.tsx @@ -102,7 +102,7 @@ const Navigation = () => { ) : ( <> - {snap.files?.[0]?.name || "XRPL Hooks"} + {snap.gistName || "XRPL Hooks"} { }); state.files = files; state.gistId = gistId; - state.gistName = Object.keys(res.data.files)?.[0] || "untitled"; state.gistOwner = res.data.owner?.login; - + + const gistName = files.find(file => file.language === 'c' || file.language === 'javascript')?.name || "untitled"; + state.gistName = gistName } catch (err) { let message: string if (err instanceof Error) message = err.message