diff --git a/ApiCore-Frontend/src/app/(app)/apiaries/[id]/page.tsx b/ApiCore-Frontend/src/app/(app)/apiaries/[id]/page.tsx index 0790448..ee73f3b 100644 --- a/ApiCore-Frontend/src/app/(app)/apiaries/[id]/page.tsx +++ b/ApiCore-Frontend/src/app/(app)/apiaries/[id]/page.tsx @@ -3,6 +3,7 @@ import Link from "next/link"; import { useParams } from "next/navigation"; import { useMutation, useQuery } from "@tanstack/react-query"; +import { toast } from "sonner"; import { fetchApiary } from "@/lib/apiaries/api"; import { exportApiaryAnnualReportPdf } from "@/lib/export/api"; import { QrCodeDialog } from "@/components/qr-code-dialog"; @@ -22,6 +23,7 @@ export default function ApiaryDetailPage() { const exportReportMutation = useMutation({ mutationFn: () => exportApiaryAnnualReportPdf(params.id, CURRENT_YEAR), + onError: () => toast.error("Jahresbericht konnte nicht exportiert werden"), }); if (isLoading) { diff --git a/ApiCore-Frontend/src/app/(app)/colonies/[id]/page.tsx b/ApiCore-Frontend/src/app/(app)/colonies/[id]/page.tsx index 9442d06..074d1d9 100644 --- a/ApiCore-Frontend/src/app/(app)/colonies/[id]/page.tsx +++ b/ApiCore-Frontend/src/app/(app)/colonies/[id]/page.tsx @@ -2,6 +2,7 @@ import { useParams } from "next/navigation"; import { useMutation, useQuery } from "@tanstack/react-query"; +import { toast } from "sonner"; import { fetchColony } from "@/lib/colonies/api"; import { exportColonyAnnualReportPdf } from "@/lib/export/api"; import { QrCodeDialog } from "@/components/qr-code-dialog"; @@ -27,6 +28,7 @@ export default function ColonyDetailPage() { const exportReportMutation = useMutation({ mutationFn: () => exportColonyAnnualReportPdf(params.id, CURRENT_YEAR), + onError: () => toast.error("Jahresbericht konnte nicht exportiert werden"), }); if (isLoading) { diff --git a/ApiCore-Frontend/src/app/(app)/colonies/page.tsx b/ApiCore-Frontend/src/app/(app)/colonies/page.tsx index 84ab9c4..278c6c4 100644 --- a/ApiCore-Frontend/src/app/(app)/colonies/page.tsx +++ b/ApiCore-Frontend/src/app/(app)/colonies/page.tsx @@ -4,6 +4,7 @@ import { useState } from "react"; import Link from "next/link"; import { Layers } from "lucide-react"; import { useMutation, useQuery } from "@tanstack/react-query"; +import { toast } from "sonner"; import { fetchColonies } from "@/lib/colonies/api"; import { ColonyStatus } from "@/lib/colonies/types"; import { COLONY_CONDITION_LABELS, COLONY_STATUS_LABELS, COLONY_TYPE_LABELS } from "@/lib/colonies/labels"; @@ -35,7 +36,10 @@ export default function ColoniesPage() { queryFn: () => fetchColonies({}), }); - const exportMutation = useMutation({ mutationFn: exportColoniesCsv }); + const exportMutation = useMutation({ + mutationFn: exportColoniesCsv, + onError: () => toast.error("CSV-Export konnte nicht heruntergeladen werden"), + }); const activeColonies = (colonies ?? []).filter((colony) => colony.deactivatedAt === null); const historyColonies = (colonies ?? []).filter((colony) => colony.deactivatedAt !== null); diff --git a/ApiCore-Frontend/src/app/(app)/honey-batches/[id]/page.tsx b/ApiCore-Frontend/src/app/(app)/honey-batches/[id]/page.tsx index 894cc20..c38d949 100644 --- a/ApiCore-Frontend/src/app/(app)/honey-batches/[id]/page.tsx +++ b/ApiCore-Frontend/src/app/(app)/honey-batches/[id]/page.tsx @@ -4,6 +4,7 @@ import Link from "next/link"; import { useParams } from "next/navigation"; import { Droplet, FlaskConical } from "lucide-react"; import { useMutation, useQuery } from "@tanstack/react-query"; +import { toast } from "sonner"; import { fetchHoneyBatch, fetchHoneyBatchTraceability } from "@/lib/honey-batches/api"; import { HONEY_BATCH_STATUS_LABELS } from "@/lib/honey-batches/labels"; import { exportHoneyBatchTraceabilityPdf } from "@/lib/export/api"; @@ -32,6 +33,7 @@ export default function HoneyBatchDetailPage() { const exportPdfMutation = useMutation({ mutationFn: () => exportHoneyBatchTraceabilityPdf(params.id), + onError: () => toast.error("PDF-Bericht konnte nicht exportiert werden"), }); if (isLoading) { diff --git a/ApiCore-Frontend/src/app/(app)/honey-batches/page.tsx b/ApiCore-Frontend/src/app/(app)/honey-batches/page.tsx index a3decfb..99277c9 100644 --- a/ApiCore-Frontend/src/app/(app)/honey-batches/page.tsx +++ b/ApiCore-Frontend/src/app/(app)/honey-batches/page.tsx @@ -3,6 +3,7 @@ import { useState } from "react"; import { Droplet } from "lucide-react"; import { useMutation, useQuery } from "@tanstack/react-query"; +import { toast } from "sonner"; import { fetchHoneyBatches } from "@/lib/honey-batches/api"; import { HoneyBatchStatus } from "@/lib/honey-batches/types"; import { HONEY_BATCH_STATUS_LABELS } from "@/lib/honey-batches/labels"; @@ -26,7 +27,10 @@ export default function HoneyBatchesPage() { queryFn: () => fetchHoneyBatches({}), }); - const exportMutation = useMutation({ mutationFn: exportHoneyBatchesCsv }); + const exportMutation = useMutation({ + mutationFn: exportHoneyBatchesCsv, + onError: () => toast.error("CSV-Export konnte nicht heruntergeladen werden"), + }); const activeBatches = (honeyBatches ?? []).filter( (batch) => !HISTORY_STATUSES.includes(batch.status),