fix: upload works in both Docker and dev mode
Falls back to absolute path on host when /app/screenshots doesn't exist. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -59,10 +59,13 @@
|
||||
const fd = new FormData();
|
||||
fd.append('file', file);
|
||||
try {
|
||||
await fetch('/upload', { method: 'POST', body: fd, credentials: 'include' });
|
||||
uploadStatus = 'done';
|
||||
setTimeout(() => uploadStatus = '', 2000);
|
||||
} catch {
|
||||
const res = await fetch('/upload', { method: 'POST', body: fd, credentials: 'include' });
|
||||
const data = await res.json();
|
||||
console.log('Upload result:', data);
|
||||
uploadStatus = data.ok ? 'done' : '';
|
||||
if (data.ok) setTimeout(() => uploadStatus = '', 2000);
|
||||
} catch (e) {
|
||||
console.error('Upload error:', e);
|
||||
uploadStatus = '';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user