feat(PROJ-2): EML/MBOX-Upload für alle Benutzer zugänglich
- Backend: neue Routen POST /api/upload + GET /api/upload/{jobID}/progress (nur Auth, kein Admin)
- api.ts: uploadMailFilesUser + getUploadProgressUser für /api/upload
- search/page.tsx: Importieren-Button + Upload-Dialog mit Drag-and-Drop, Fortschrittsanzeige und automatischer Suchlisten-Aktualisierung nach Import
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -484,3 +484,22 @@ export async function uploadMailFiles(files: File[]): Promise<{ job_id: string }
|
||||
export async function getUploadProgress(jobID: string): Promise<UploadJob> {
|
||||
return request<UploadJob>(`/api/admin/upload/${jobID}/progress`);
|
||||
}
|
||||
|
||||
export async function uploadMailFilesUser(files: File[]): Promise<{ job_id: string }> {
|
||||
const form = new FormData();
|
||||
for (const f of files) form.append("files", f);
|
||||
const res = await fetch(`${API_BASE}/api/upload`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
body: form,
|
||||
});
|
||||
if (!res.ok) {
|
||||
const body = await res.text();
|
||||
throw new Error(body || `Upload failed: ${res.status}`);
|
||||
}
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function getUploadProgressUser(jobID: string): Promise<UploadJob> {
|
||||
return request<UploadJob>(`/api/upload/${jobID}/progress`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user