mirror of
https://github.com/jaywcjlove/wxmp.git
synced 2026-01-12 08:18:49 +08:00
feat: add electron app.
This commit is contained in:
25
website/src/store/getMdSource.tsx
Normal file
25
website/src/store/getMdSource.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import toast from 'react-hot-toast';
|
||||
import styled from 'styled-components';
|
||||
|
||||
const Warpper = styled.div`
|
||||
font-size: 0.8rem;
|
||||
`;
|
||||
|
||||
export const useMdSource = (url: string | null) => {
|
||||
return useQuery(['database-list', url], () => {
|
||||
if (!url) return Promise.resolve('');
|
||||
return fetch(url)
|
||||
.then((response) => response.text())
|
||||
.then((data) => {
|
||||
return data;
|
||||
})
|
||||
.catch((err) => {
|
||||
toast.error(
|
||||
<Warpper>
|
||||
加载失败!<a href={url}>请检查你的URL</a>
|
||||
</Warpper>,
|
||||
);
|
||||
});
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user