mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-28 09:03:53 +00:00
16 lines
363 B
TypeScript
16 lines
363 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
|
|
export const getMd = async (url: string) => {
|
|
const response = await fetch(`/docs/${url}`);
|
|
const textContent = await response.text();
|
|
return textContent;
|
|
};
|
|
|
|
export const useMarkdown = ({ url }: { url: string }) => {
|
|
const { data = '' } = useQuery([url], () => getMd(url));
|
|
|
|
return {
|
|
data
|
|
};
|
|
};
|