20260429_232038-fix: map backend upload response fields (file_url->url, object_name->id)
This commit is contained in:
@@ -87,7 +87,7 @@ export async function deleteTemplate(id: string): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Media
|
// 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();
|
const formData = new FormData();
|
||||||
formData.append('file', file);
|
formData.append('file', file);
|
||||||
if (projectId) {
|
if (projectId) {
|
||||||
@@ -98,7 +98,8 @@ export async function uploadMedia(file: File, projectId?: string): Promise<{ obj
|
|||||||
'Content-Type': 'multipart/form-data',
|
'Content-Type': 'multipart/form-data',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return response.data;
|
const { file_url, object_name } = response.data;
|
||||||
|
return { url: file_url, id: object_name };
|
||||||
}
|
}
|
||||||
|
|
||||||
// AI Prediction
|
// AI Prediction
|
||||||
|
|||||||
Reference in New Issue
Block a user