From 63b67e8bfceb5fb4f7c2c003533a22c660c2d011 Mon Sep 17 00:00:00 2001 From: Sven van de Scheur Date: Mon, 28 Oct 2024 11:54:23 +0100 Subject: [PATCH] :loud_sound: #459 - refactor: fix some incorrect logging --- frontend/src/hooks/useAuditLog.ts | 4 +--- frontend/src/hooks/useLatestReviewResponse.ts | 4 +--- frontend/src/hooks/useReviewers.ts | 4 +--- .../destructionlist/hooks/useSelectielijstKlasseChoices.ts | 4 +--- .../src/pages/destructionlist/hooks/useZaaktypeChoices.ts | 4 +--- 5 files changed, 5 insertions(+), 15 deletions(-) diff --git a/frontend/src/hooks/useAuditLog.ts b/frontend/src/hooks/useAuditLog.ts index 0b2f7ee76..2c1b161ff 100644 --- a/frontend/src/hooks/useAuditLog.ts +++ b/frontend/src/hooks/useAuditLog.ts @@ -8,7 +8,6 @@ import { DestructionList } from "../lib/api/destructionLists"; * Hook resolving audit log items */ export function useAuditLog(destructionList?: DestructionList): AuditLogItem[] { - const [errorState, setErrorState] = useState(); const alert = useAlert(); const [auditLogState, setAuditLogState] = useState([]); @@ -21,13 +20,12 @@ export function useAuditLog(destructionList?: DestructionList): AuditLogItem[] { listAuditLog(destructionList.uuid) .then((a) => setAuditLogState(a)) .catch((e) => { - console.error(errorState); + console.error(e); alert( "Foutmelding", "Er is een fout opgetreden bij het ophalen van de audit log!", "Ok", ); - setErrorState(e); }); }, [destructionList?.uuid]); diff --git a/frontend/src/hooks/useLatestReviewResponse.ts b/frontend/src/hooks/useLatestReviewResponse.ts index 9e00a720e..4f3c98248 100644 --- a/frontend/src/hooks/useLatestReviewResponse.ts +++ b/frontend/src/hooks/useLatestReviewResponse.ts @@ -13,7 +13,6 @@ import { export function useLatestReviewResponse( review?: Review, ): ReviewResponse | null { - const [errorState, setErrorState] = useState(); const alert = useAlert(); const [reviewResponseState, setReviewResponseState] = @@ -26,13 +25,12 @@ export function useLatestReviewResponse( getLatestReviewResponse({ review: review.pk }) .then((r) => setReviewResponseState(r || null)) .catch((e) => { - console.error(errorState); + console.error(e); alert( "Foutmelding", "Er is een fout opgetreden bij het ophalen van de verwerkte beoordeling!", "Ok", ); - setErrorState(e); }); }, [review?.pk]); diff --git a/frontend/src/hooks/useReviewers.ts b/frontend/src/hooks/useReviewers.ts index 745c7dbe9..2cb334734 100644 --- a/frontend/src/hooks/useReviewers.ts +++ b/frontend/src/hooks/useReviewers.ts @@ -8,7 +8,6 @@ import { listReviewers } from "../lib/api/reviewers"; * Hook resolving reviewers */ export function useReviewers(): User[] { - const [errorState, setErrorState] = useState(); const alert = useAlert(); const [reviewersState, setReviewersState] = useState([]); @@ -16,13 +15,12 @@ export function useReviewers(): User[] { listReviewers() .then((r) => setReviewersState(r)) .catch((e) => { - console.error(errorState); + console.error(e); alert( "Foutmelding", "Er is een fout opgetreden bij het ophalen van beoordelaars!", "Ok", ); - setErrorState(e); }); }, []); diff --git a/frontend/src/pages/destructionlist/hooks/useSelectielijstKlasseChoices.ts b/frontend/src/pages/destructionlist/hooks/useSelectielijstKlasseChoices.ts index 20e7a3ed6..c47a4cae2 100644 --- a/frontend/src/pages/destructionlist/hooks/useSelectielijstKlasseChoices.ts +++ b/frontend/src/pages/destructionlist/hooks/useSelectielijstKlasseChoices.ts @@ -7,7 +7,6 @@ import { listSelectielijstKlasseChoices } from "../../../lib/api/private"; * Hook resolving selectielijst choices */ export function useSelectielijstKlasseChoices(): Option[] { - const [errorState, setErrorState] = useState(); const alert = useAlert(); const [selectielijstChoicesState, setSelectielijstChoicesState] = useState< @@ -17,13 +16,12 @@ export function useSelectielijstKlasseChoices(): Option[] { listSelectielijstKlasseChoices() .then((s) => setSelectielijstChoicesState(s)) .catch((e) => { - console.error(errorState); + console.error(e); alert( "Foutmelding", "Er is een fout opgetreden bij het ophalen van selectielijst klassen!", "Ok", ); - setErrorState(e); }); }, []); diff --git a/frontend/src/pages/destructionlist/hooks/useZaaktypeChoices.ts b/frontend/src/pages/destructionlist/hooks/useZaaktypeChoices.ts index 8fc511997..d812ee4ca 100644 --- a/frontend/src/pages/destructionlist/hooks/useZaaktypeChoices.ts +++ b/frontend/src/pages/destructionlist/hooks/useZaaktypeChoices.ts @@ -14,7 +14,6 @@ export function useZaaktypeChoices( destructionList?: DestructionList, review?: Review, ): ZaaktypeChoice[] { - const [errorState, setErrorState] = useState(); const alert = useAlert(); const [zaaktypeChoicesState, setZaaktypeChoicesState] = useState< @@ -24,13 +23,12 @@ export function useZaaktypeChoices( listZaaktypeChoices(destructionList?.uuid, review?.pk) .then((z) => setZaaktypeChoicesState(z)) .catch((e) => { - console.error(errorState); + console.error(e); alert( "Foutmelding", "Er is een fout opgetreden bij het ophalen van zaaktypen!", "Ok", ); - setErrorState(e); }); }, [destructionList?.uuid, review?.pk]);