return download url

This commit is contained in:
smanylov
2026-02-12 16:45:29 +07:00
parent 03920524d3
commit f3e8ef3f65
+3 -3
View File
@@ -48,6 +48,7 @@ type ApiFile = {
status: string;
protectStatus: string;
supportId: number;
fileName: string;
};
type ApiResponse = {
@@ -474,8 +475,7 @@ export default function TanstakFilesTable({ fileType }: { fileType: string }) {
setIsFileLoading(true);
try {
/* const response = await fetch(`/api/download/${file.id}`); */
const response = await fetch(`/api/v1/files/download/${file.id}`);
const response = await fetch(`/api/download/${file.id}`);
if (!response.ok) {
throw new Error(`error: ${response.status}`);
@@ -485,7 +485,7 @@ export default function TanstakFilesTable({ fileType }: { fileType: string }) {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = file.fileName || `file-${file.id}`;
a.download = file._original?.fileName || file.fileName || `file-${file.id}`;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);