You've already forked isop-mirror
refactor: move triggerDownload function to utils
This commit is contained in:
9
frontend/app/utils/index.ts
Normal file
9
frontend/app/utils/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export function triggerDownload(file: Blob, file_name: string) {
|
||||
const url = window.URL.createObjectURL(file);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = `${file_name}.pdf`;
|
||||
link.target = "_blank";
|
||||
link.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
}
|
||||
Reference in New Issue
Block a user