Strip trailing slash from VITE_API_URL to prevent double-slash 404s

A trailing slash on the API base URL produced requests like
".com//api/signup" that 404'd, since every call site concatenates a
leading-slash path directly onto BASE. Now stripped defensively
regardless of how the env var is set. Also updated the fallback default
to the current api.getodoomcp.com domain.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
MOHAN 2026-07-05 02:35:57 +05:30
parent f184887fb3
commit dfd4f6cda9

View File

@ -1,4 +1,8 @@
const BASE = import.meta.env.VITE_API_URL ?? 'https://odoo-mcp.thedomainnest.com'; // Strip any trailing slash regardless of how VITE_API_URL was set — every
// call site below concatenates a leading-slash path directly onto BASE
// (e.g. `${BASE}/api/signup`), so a trailing slash here would silently
// produce a double-slash URL that 404s.
const BASE = (import.meta.env.VITE_API_URL ?? 'https://api.getodoomcp.com').replace(/\/+$/, '');
// FastAPI's `detail` field is a plain string for handler-raised HTTPExceptions, // FastAPI's `detail` field is a plain string for handler-raised HTTPExceptions,
// but an array of {loc, msg, type} objects for its own automatic request // but an array of {loc, msg, type} objects for its own automatic request