fix: Maps-Vault-Sync sofort nach Google Maps, nicht erst nach Anymailfinder

- Google Maps Ergebnisse werden direkt nach der Suche in LeadVault gespeichert
- Anymailfinder-Fehler führen nicht mehr zum Datenverlust
- Bessere Fehlermeldungen: echter Fehlertext statt hardcoded Message
- Anymailfinder-Fehlermeldung auf Deutsch

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Timo Uttenweiler
2026-03-20 18:01:44 +01:00
parent 82c4244233
commit f914ab6e47
2 changed files with 40 additions and 31 deletions

View File

@@ -121,14 +121,14 @@ export default function MapsPage() {
try {
const res = await fetch(`/api/jobs/${id}/status`);
const data = await res.json() as {
status: string; totalLeads: number; emailsFound: number; results: ResultRow[];
status: string; totalLeads: number; emailsFound: number; results: ResultRow[]; error?: string;
};
if (data.totalLeads > 0 && data.emailsFound === 0 && enrichEmails) {
phase = "Enriching with Anymailfinder...";
phase = "Anreicherung mit Anymailfinder...";
}
if (data.emailsFound > 0) {
phase = `Found ${data.emailsFound} emails so far...`;
phase = `${data.emailsFound} E-Mails gefunden...`;
}
setProgress({
@@ -146,12 +146,13 @@ export default function MapsPage() {
if (data.status === "complete") {
setStage("done");
const msg = enrichEmails
? `Done! ${data.totalLeads} companies found, ${data.emailsFound} emails enriched`
: `Done! ${data.totalLeads} companies found`;
? `Fertig! ${data.totalLeads} Unternehmen gefunden, ${data.emailsFound} E-Mails angereichert`
: `Fertig! ${data.totalLeads} Unternehmen gefunden`;
toast.success(msg);
} else {
setStage("failed");
toast.error("Job failed. Check your Google Maps API key in Settings.");
const errMsg = data.error || "Unbekannter Fehler";
toast.error(`Job fehlgeschlagen: ${errMsg}`);
}
}
} catch {