ФУНКЦИИ - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: filestorage upload и preview вложений

This commit is contained in:
DCCONSTRUCTIONS
2026-04-25 13:05:03 +03:00
parent 5f2d543cab
commit c4032e3040
43 changed files with 982 additions and 127 deletions
@@ -35,7 +35,7 @@ export class FileUploadService extends APIService {
if (axios.isCancel(error)) {
console.log(error.message);
} else {
throw error?.response?.data;
throw error?.response?.data ?? error;
}
});
}
@@ -55,16 +55,32 @@ export class IssueAttachmentService extends APIService {
.then(async (response) => {
const signedURLResponse: TIssueAttachmentUploadResponse = response?.data;
const fileUploadPayload = generateFileUploadPayload(signedURLResponse, file);
await this.fileUploadService.uploadFile(
signedURLResponse.upload_data.url,
fileUploadPayload,
uploadProgressHandler
);
await this.updateIssueAttachmentUploadStatus(workspaceSlug, projectId, issueId, signedURLResponse.asset_id);
let uploadError: unknown;
try {
await this.fileUploadService.uploadFile(
signedURLResponse.upload_data.url,
fileUploadPayload,
uploadProgressHandler
);
} catch (error) {
uploadError = error;
}
try {
await this.updateIssueAttachmentUploadStatus(workspaceSlug, projectId, issueId, signedURLResponse.asset_id);
} catch (error) {
await this.deleteIssueAttachment(workspaceSlug, projectId, issueId, signedURLResponse.asset_id).catch(
(deleteError) => {
console.error("Error in cleaning failed issue attachment upload:", deleteError);
}
);
throw uploadError ?? error;
}
return signedURLResponse.attachment;
})
.catch((error) => {
throw error?.response?.data;
throw error?.response?.data ?? error;
});
}
@@ -74,7 +90,7 @@ export class IssueAttachmentService extends APIService {
)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
throw error?.response?.data ?? error;
});
}
@@ -89,7 +105,7 @@ export class IssueAttachmentService extends APIService {
)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
throw error?.response?.data ?? error;
});
}
}