Fix gist name.
This commit is contained in:
@@ -102,7 +102,7 @@ const Navigation = () => {
|
|||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Heading css={{ lineHeight: 1 }}>
|
<Heading css={{ lineHeight: 1 }}>
|
||||||
{snap.files?.[0]?.name || "XRPL Hooks"}
|
{snap.gistName || "XRPL Hooks"}
|
||||||
</Heading>
|
</Heading>
|
||||||
<Text
|
<Text
|
||||||
css={{ fontSize: "$xs", color: "$mauve10", lineHeight: 1 }}
|
css={{ fontSize: "$xs", color: "$mauve10", lineHeight: 1 }}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Octokit } from "@octokit/core";
|
import { Octokit } from "@octokit/core";
|
||||||
import state, { IFile } from '../index';
|
import state, { IFile } from '../index';
|
||||||
import { templateFileIds } from '../constants';
|
import { templateFileIds } from '../constants';
|
||||||
|
import { file } from 'jszip';
|
||||||
|
|
||||||
const octokit = new Octokit();
|
const octokit = new Octokit();
|
||||||
|
|
||||||
@@ -74,9 +75,10 @@ export const fetchFiles = async (gistId: string) => {
|
|||||||
});
|
});
|
||||||
state.files = files;
|
state.files = files;
|
||||||
state.gistId = gistId;
|
state.gistId = gistId;
|
||||||
state.gistName = Object.keys(res.data.files)?.[0] || "untitled";
|
|
||||||
state.gistOwner = res.data.owner?.login;
|
state.gistOwner = res.data.owner?.login;
|
||||||
|
|
||||||
|
const gistName = files.find(file => file.language === 'c' || file.language === 'javascript')?.name || "untitled";
|
||||||
|
state.gistName = gistName
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
let message: string
|
let message: string
|
||||||
if (err instanceof Error) message = err.message
|
if (err instanceof Error) message = err.message
|
||||||
|
|||||||
Reference in New Issue
Block a user