mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? fix: display specific error message when previewing file error #868 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
26 lines
584 B
TypeScript
26 lines
584 B
TypeScript
import { Spin } from 'antd';
|
|
import FileError from '../file-error';
|
|
|
|
import { useFetchDocx } from '../hooks';
|
|
import styles from './index.less';
|
|
|
|
const Docx = ({ filePath }: { filePath: string }) => {
|
|
const { succeed, containerRef, error } = useFetchDocx(filePath);
|
|
|
|
return (
|
|
<>
|
|
{succeed ? (
|
|
<section className={styles.docxViewerWrapper}>
|
|
<div id="docx" ref={containerRef} className={styles.box}>
|
|
<Spin />
|
|
</div>
|
|
</section>
|
|
) : (
|
|
<FileError>{error}</FileError>
|
|
)}
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default Docx;
|