fixed image upload
This commit is contained in:
parent
96828994e1
commit
fd1afc5f3a
3 changed files with 10 additions and 3 deletions
|
|
@ -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})`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue