Skip to content

Commit

Permalink
🔊 #459 - refactor: fix some incorrect logging
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvandescheur committed Oct 28, 2024
1 parent 6aca9d4 commit 63b67e8
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 15 deletions.
4 changes: 1 addition & 3 deletions frontend/src/hooks/useAuditLog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<unknown>();
const alert = useAlert();

const [auditLogState, setAuditLogState] = useState<AuditLogItem[]>([]);
Expand All @@ -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]);

Expand Down
4 changes: 1 addition & 3 deletions frontend/src/hooks/useLatestReviewResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
export function useLatestReviewResponse(
review?: Review,
): ReviewResponse | null {
const [errorState, setErrorState] = useState<unknown>();
const alert = useAlert();

const [reviewResponseState, setReviewResponseState] =
Expand All @@ -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]);

Expand Down
4 changes: 1 addition & 3 deletions frontend/src/hooks/useReviewers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,19 @@ import { listReviewers } from "../lib/api/reviewers";
* Hook resolving reviewers
*/
export function useReviewers(): User[] {
const [errorState, setErrorState] = useState<unknown>();
const alert = useAlert();

const [reviewersState, setReviewersState] = useState<User[]>([]);
useEffect(() => {
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);
});
}, []);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { listSelectielijstKlasseChoices } from "../../../lib/api/private";
* Hook resolving selectielijst choices
*/
export function useSelectielijstKlasseChoices(): Option[] {
const [errorState, setErrorState] = useState<unknown>();
const alert = useAlert();

const [selectielijstChoicesState, setSelectielijstChoicesState] = useState<
Expand All @@ -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);
});
}, []);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export function useZaaktypeChoices(
destructionList?: DestructionList,
review?: Review,
): ZaaktypeChoice[] {
const [errorState, setErrorState] = useState<unknown>();
const alert = useAlert();

const [zaaktypeChoicesState, setZaaktypeChoicesState] = useState<
Expand All @@ -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]);

Expand Down

0 comments on commit 63b67e8

Please sign in to comment.