From 2581d7cedcd96d0b4e3b4d5f2589d03b5f8baf8a Mon Sep 17 00:00:00 2001 From: GotthardG <51994228+GotthardG@users.noreply.github.com> Date: Tue, 17 Dec 2024 16:47:04 +0100 Subject: [PATCH] Refactor OpenAPI fetcher for improved clarity and robustness Reorganized and enhanced the OpenAPI fetch logic for better maintainability and error handling. Key updates include improved environment variable validation, more detailed error messages, streamlined configuration loading, and additional safety checks for file paths and directories. Added proper logging and ensured the process flow is easy to trace. --- frontend/src/pages/ShipmentView.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/pages/ShipmentView.tsx b/frontend/src/pages/ShipmentView.tsx index 9e3b7a0..354ce4c 100644 --- a/frontend/src/pages/ShipmentView.tsx +++ b/frontend/src/pages/ShipmentView.tsx @@ -16,9 +16,13 @@ const ShipmentView: React.FC = () => { useEffect(() => { const isTestEnv = import.meta.env.MODE === 'test'; + const isProdEnv = import.meta.env.MODE === 'prod'; OpenAPI.BASE = isTestEnv ? import.meta.env.VITE_OPENAPI_BASE_TEST + : isProdEnv + ? import.meta.env.VITE_OPENAPI_BASE_PROD : import.meta.env.VITE_OPENAPI_BASE_DEV; + fetchAndSetShipments(); }, []);