Refactor: Remove ant design component (#13143)

### What problem does this PR solve?

_Briefly describe what this PR aims to solve. Include background context
that will help reviewers understand the purpose of the PR._

### Type of change

- [x] Refactoring
This commit is contained in:
chanx
2026-02-13 18:40:41 +08:00
committed by GitHub
parent bc9ed24a85
commit f2a1d59c36
51 changed files with 1074 additions and 1484 deletions

View File

@@ -165,3 +165,24 @@ export const useFetchDocx = (filePath: string) => {
return { succeed, containerRef, error };
};
export const useCatchDocumentError = (url: string) => {
const httpHeaders = useMemo(() => {
return {
[Authorization]: getAuthorization(),
};
}, []);
const [error, setError] = useState<string>('');
const fetchDocument = useCallback(async () => {
const { data } = await axios.get(url, { headers: httpHeaders });
if (data.code !== 0) {
setError(data?.message);
}
}, [url, httpHeaders]);
useEffect(() => {
fetchDocument();
}, [fetchDocument]);
return error;
};

View File

@@ -13,7 +13,7 @@ import { Spin } from '@/components/ui/spin';
import { Authorization } from '@/constants/authorization';
import FileError from '@/pages/document-viewer/file-error';
import { getAuthorization } from '@/utils/authorization-util';
import { useCatchDocumentError } from '../pdf-previewer/hooks';
import { useCatchDocumentError } from './hooks';
import styles from './index.module.less';
type PdfLoaderProps = React.ComponentProps<typeof PdfLoader> & {
httpHeaders?: Record<string, string>;