fix: restore /api prefix in frontend baseURL, strip from API_URL fallback

The previous 'double /api' fix (d5adc2f) was wrong. Production sets
NEXT_PUBLIC_API_URL without /api, so the old `${API_URL}/api` was
load-bearing. The real fix: remove /api from the fallback values
(both browser and dev branches), keep /api only in the baseURL literal.

Before: API_URL fallback included /api → double /api when env var absent
After:  API_URL is origin only → baseURL = `${origin}/api` always correct
This commit is contained in:
2026-04-30 14:57:43 -04:00
parent d5adc2f985
commit 3377b1e751
+3 -3
View File
@@ -3,11 +3,11 @@ import axios from "axios";
const API_URL =
process.env.NEXT_PUBLIC_API_URL ||
(typeof window !== "undefined"
? `${window.location.origin}/api`
: "http://localhost:3001/api");
? window.location.origin
: "http://localhost:3001");
export const api = axios.create({
baseURL: API_URL,
baseURL: `${API_URL}/api`,
headers: {
"Content-Type": "application/json",
},