upload file is working

This commit is contained in:
m
2026-07-11 22:10:17 +02:00
parent b1f7fe6959
commit 8e728c9042
12 changed files with 158 additions and 71 deletions
-18
View File
@@ -43,24 +43,6 @@ class ApiClient {
async delete<T>(endpoint: string): Promise<T> {
return this.request<T>(endpoint, { method: 'DELETE' });
}
async uploadFile<T>(endpoint: string, formData: FormData): Promise<T> {
const url = `${this.baseUrl}${endpoint}`;
const response = await fetch(url, {
method: 'POST',
body: formData,
headers: {
'Content-Type': 'multipart/form-data',
},
});
if (!response.ok) {
const error: ApiError = await response.json();
throw new Error(error.error?.message || 'Upload failed');
}
return response.json();
}
}
export const apiClient = new ApiClient(API_BASE_URL);