20260429_232038-fix: map backend upload response fields (file_url->url, object_name->id)

This commit is contained in:
2026-04-29 23:18:32 +08:00
parent d7d1e3225f
commit 51f1a60216

View File

@@ -87,7 +87,7 @@ export async function deleteTemplate(id: string): Promise<void> {
}
// 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