mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-15 16:51:37 +00:00
add gist loading page
format code
This commit is contained in:
@ -45,7 +45,7 @@ export const getGists = cache(async (page = 1, perPage = 10) => {
|
||||
const text = l.match(relMatch)?.[1] as PageKeys;
|
||||
if (!text) return;
|
||||
pageSize[text] = new URLSearchParams(
|
||||
l.match(linkMatch)?.[1].split('?')[1]
|
||||
l.match(linkMatch)?.[1].split('?')[1],
|
||||
).get('page');
|
||||
});
|
||||
|
||||
@ -68,9 +68,9 @@ export const getGists = cache(async (page = 1, perPage = 10) => {
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
})
|
||||
}),
|
||||
);
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
return {
|
||||
@ -127,7 +127,7 @@ export const getSignalGist = cache(async (id: string) => {
|
||||
content: '',
|
||||
};
|
||||
target.content = await fetch(url).then((res) => res.text());
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
return data;
|
||||
|
@ -13,7 +13,7 @@ const useInView = () => {
|
||||
observer.unobserve(ref.current);
|
||||
});
|
||||
},
|
||||
[]
|
||||
[],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -13,7 +13,7 @@ const useRouterLoading = () => {
|
||||
(url: string) => {
|
||||
url !== router.pathname ? setLoading(true) : setLoading(false);
|
||||
},
|
||||
[router.pathname]
|
||||
[router.pathname],
|
||||
);
|
||||
const handleComplete = useCallback(() => {
|
||||
setLoading(false);
|
||||
|
@ -14,7 +14,7 @@ export const dataPath = 'content/posts';
|
||||
const readFileMeta = async (filename: string) => {
|
||||
const markdownWithMeta = await fs.readFile(
|
||||
path.join(dataPath, filename),
|
||||
'utf-8'
|
||||
'utf-8',
|
||||
);
|
||||
const slug = filename.replace(/\.mdx$/, '');
|
||||
const { data: meta } = matter(markdownWithMeta);
|
||||
|
Reference in New Issue
Block a user