Refactor puck handling and update tell position setting

Simplify and standardize puck name normalization and validation. Refactor `set_tell_positions` to handle batch operations, improve error handling, and provide detailed responses for each puck. Removed unnecessary `with-tell-position` endpoint for better clarity and maintainability.
This commit is contained in:
GotthardG 2024-12-19 15:37:39 +01:00
parent da5dbb9e31
commit 6ff9cbe327

View File

@ -57,11 +57,26 @@ const LoginView: React.FC = () => {
const navigate = useNavigate();
useEffect(() => {
const isTestEnv = import.meta.env.MODE === 'test';
OpenAPI.BASE = isTestEnv
// Detect the current environment
const mode = import.meta.env.MODE;
// Dynamically set `OpenAPI.BASE` based on the mode
OpenAPI.BASE =
mode === 'test'
? import.meta.env.VITE_OPENAPI_BASE_TEST
: mode === 'prod'
? import.meta.env.VITE_OPENAPI_BASE_PROD
: import.meta.env.VITE_OPENAPI_BASE_DEV;
;
// Log warning if `OpenAPI.BASE` is unresolved
if (!OpenAPI.BASE) {
console.error('OpenAPI.BASE is not set. Falling back to a default value.');
OpenAPI.BASE = 'https://default-url.com'; // Use a consistent fallback
}
// Debug for mode and resolved `BASE`
console.log('Environment Mode:', mode);
console.log('Resolved OpenAPI.BASE:', OpenAPI.BASE);
}, []);
const handleLogin = async (e: React.FormEvent) => {