优化文件上传逻辑,统一JWT令牌处理方式,简化请求头设置,提升代码可读性。

This commit is contained in:
2025-09-22 11:48:12 +08:00
parent aec2e1fca2
commit f2750773f9
3 changed files with 14 additions and 7 deletions
+4 -2
View File
@@ -788,13 +788,14 @@ export default function DocumentsIndex() {
try {
setAttachmentUploading(true);
const jwtToken = (loaderData.frontendJWT as string | undefined) || (loaderData.userInfo?.frontend_jwt as unknown as string | undefined);
const result = await appendContractAttachments(
selectedDocumentId,
attachmentFiles,
attachmentMergeMode,
true, // isReprocess
attachmentRemark || undefined,
loaderData.frontendJWT as string | undefined
jwtToken
);
if (result.error) {
@@ -862,11 +863,12 @@ export default function DocumentsIndex() {
try {
setTemplateUploading(true);
const jwtToken = (loaderData.frontendJWT as string | undefined) || (loaderData.userInfo?.frontend_jwt as unknown as string | undefined);
const result = await uploadContractTemplate(
templateFile,
selectedDocumentId,
undefined, // comparisonId
loaderData.frontendJWT as string | undefined
jwtToken
);
if (result.error) {