File download

This commit is contained in:
2025-05-12 22:44:22 +08:00
parent bea9e24e98
commit 7be2d10472
5 changed files with 53 additions and 2 deletions

View File

@@ -529,6 +529,10 @@ class Network {
};
}
}
getFileDownloadLink(fileId: number): string {
return `${this.apiBaseUrl}/files/download/${fileId}`;
}
}
export const network = new Network();

View File

@@ -147,7 +147,10 @@ function FileTile({file}: { file: RFile }) {
<p className={"text-sm"}>{file.description}</p>
</div>
<div>
<button className={"btn btn-primary btn-soft btn-square"}>
<button className={"btn btn-primary btn-soft btn-square"} onClick={() => {
const link = network.getFileDownloadLink(file.id);
window.open(link, "_blank");
}}>
<MdOutlineDownload size={24}/>
</button>
</div>