fixed image upload

This commit is contained in:
Jakub Dorfman 2026-09-28 19:52:24 +02:00
parent 96828994e1
commit fd1afc5f3a
3 changed files with 10 additions and 3 deletions

View file

@ -6,7 +6,7 @@ export async function uploadMedia(file: File) {
formData.append('file', file);
formData.append('alt', file.name.replace(/\.[^/.]+$/, '').replace(/[-_]/g, ' '));
const res = await fetch('/admin/api/upload', { method: 'POST', body: formData });
const res = await fetch('/api/upload', { method: 'POST', body: formData });
if (!res.ok) {
const err = await res.json().catch(() => ({}));
throw new Error(err?.message || `Upload failed (${res.status})`);