From 51f1a60216c1295aeacd7cf409c71ca6463db4f5 Mon Sep 17 00:00:00 2001 From: admin <572701190@qq.com> Date: Wed, 29 Apr 2026 23:18:32 +0800 Subject: [PATCH] 20260429_232038-fix: map backend upload response fields (file_url->url, object_name->id) --- src/lib/api.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/api.ts b/src/lib/api.ts index 5fe4075..053a480 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -87,7 +87,7 @@ export async function deleteTemplate(id: string): Promise { } // Media -export async function uploadMedia(file: File, projectId?: string): Promise<{ object_name: string; file_url: string; size: number; message: string }> { +export async function uploadMedia(file: File, projectId?: string): Promise<{ url: string; id: string }> { const formData = new FormData(); formData.append('file', file); if (projectId) { @@ -98,7 +98,8 @@ export async function uploadMedia(file: File, projectId?: string): Promise<{ obj 'Content-Type': 'multipart/form-data', }, }); - return response.data; + const { file_url, object_name } = response.data; + return { url: file_url, id: object_name }; } // AI Prediction