Skip to content

Commit

Permalink
fix: Prevent List component from erroring on displaying errors (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathcolo authored Sep 16, 2024
1 parent f06a3cb commit 1b485bf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions js/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const useApiResult = <RawData, Data>({
setResult({ status: "ok", result: parsedData });
})
.catch((e: unknown) => {
console.error(e);
setResult({ status: "error", error: e });
});
}, [url, RawData, parser]);
Expand Down
4 changes: 2 additions & 2 deletions js/components/operatorSignIn/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export const List = ({ line }: { line: HeavyRailLine }): ReactElement => {
if (signIns.status === "loading" || employees.status === "loading") {
return <>Loading...</>;
} else if (signIns.status === "error") {
return <>Error retrieving signins: {signIns.error}</>;
return <>Error retrieving signins.</>;
} else if (employees.status === "error") {
return <>Error retrieving employees: {employees.error}</>;
return <>Error retrieving employees.</>;
}

return (
Expand Down

0 comments on commit 1b485bf

Please sign in to comment.