From dfd4f6cda9a8f862bc0017456639d481240a9ee2 Mon Sep 17 00:00:00 2001 From: MOHAN Date: Sun, 5 Jul 2026 02:35:57 +0530 Subject: [PATCH] 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 --- src/lib/api.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/api.ts b/src/lib/api.ts index a44abf5..d4363de 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -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, // but an array of {loc, msg, type} objects for its own automatic request