Update: FileDialog download method

This commit is contained in:
2021-11-25 23:33:35 +08:00
parent 85a6c2b859
commit d8470d0f4b

View File

@@ -9,16 +9,20 @@ function FileDialog(props) {
let navigate = useNavigate(); let navigate = useNavigate();
const downloadURL = "/api/v1/get_file_direct?id=" + props.file.id;
return ( return (
<dialog open={props.showStatus}> <dialog open={props.showStatus}>
<p>{props.file.filename}</p> <p>{props.file.filename}</p>
<p> <p>
Download 使用 Axios 异步下载 Download 使用浏览器下载原文件
<br /> <br />
Play 调用网页播放器播放 Play 调用网页播放器播放
<br /> <br />
</p> </p>
<button>Download</button> <a href={downloadURL} download>
<button>Download</button>
</a>
<button <button
onClick={() => { onClick={() => {
props.setPlayingFile(props.file); props.setPlayingFile(props.file);