mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
File download
This commit is contained in:
@@ -529,6 +529,10 @@ class Network {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
getFileDownloadLink(fileId: number): string {
|
||||
return `${this.apiBaseUrl}/files/download/${fileId}`;
|
||||
}
|
||||
}
|
||||
|
||||
export const network = new Network();
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user