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:
parent
da5dbb9e31
commit
6ff9cbe327
@ -57,11 +57,26 @@ const LoginView: React.FC = () => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const isTestEnv = import.meta.env.MODE === 'test';
|
// Detect the current environment
|
||||||
OpenAPI.BASE = isTestEnv
|
const mode = import.meta.env.MODE;
|
||||||
? import.meta.env.VITE_OPENAPI_BASE_TEST
|
|
||||||
: import.meta.env.VITE_OPENAPI_BASE_DEV;
|
// 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) => {
|
const handleLogin = async (e: React.FormEvent) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user