Commit 3745108d authored by Kantz's avatar Kantz
Browse files

VITE_BACKEND_URL entfernt

parent 5c935bed
......@@ -72,11 +72,8 @@ Optional in `math-tutor/frontend/.env`:
```env
VITE_PROXY_TARGET="http://<BACKEND_HOST>:8000"
VITE_BACKEND_URL=""
```
`VITE_BACKEND_URL=""` keeps requests relative so they use the proxy. If you set `VITE_BACKEND_URL` to a full URL, requests bypass the proxy and CORS must be configured accordingly.
## Docker Compose (Production-style)
Template files:
......
VITE_BACKEND_URL=""
\ No newline at end of file
VITE_FRONTEND_LANG="de"
......@@ -8,9 +8,6 @@ import type { ChatMessage } from "../components/Chat/MessageList";
import type { RetrievedDoc } from "../components/Retrieval/DocPanel";
import { t } from "../i18n";
// Empty fallback uses Vite proxy (/api -> backend target) in development.
const backendUrl = import.meta.env.VITE_BACKEND_URL || "";
const initialMessages: ChatMessage[] = [];
type ArchivedChatSummary = {
......@@ -245,7 +242,7 @@ export default function App() {
const loadTasks = async () => {
setTasksError(null);
try {
const response = await fetch(`${backendUrl}/api/tasks`);
const response = await fetch(`/api/tasks`);
if (!response.ok) {
throw new Error(`Tasks failed: ${response.status}`);
}
......@@ -317,7 +314,7 @@ export default function App() {
const syncTaskSelection = async () => {
try {
await fetch(`${backendUrl}/api/tasks/select`, {
await fetch(`/api/tasks/select`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
......@@ -371,7 +368,7 @@ export default function App() {
};
}
const response = await fetch(`${backendUrl}/api/chat`, {
const response = await fetch(`/api/chat`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(chatPayload),
......@@ -409,7 +406,7 @@ export default function App() {
}
try {
const contextResponse = await fetch(`${backendUrl}/api/context/retrieval`, {
const contextResponse = await fetch(`/api/context/retrieval`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
......@@ -514,9 +511,7 @@ export default function App() {
const loadArchives = async () => {
setArchiveError(null);
try {
const response = await fetch(
`${backendUrl}/api/chat/archives?limit=50`
);
const response = await fetch(`/api/chat/archives?limit=50`);
if (!response.ok) {
throw new Error(`Archive list failed: ${response.status}`);
}
......@@ -538,9 +533,7 @@ export default function App() {
}
setArchiveError(null);
try {
const response = await fetch(
`${backendUrl}/api/chat/archive/${targetId}`
);
const response = await fetch(`/api/chat/archive/${targetId}`);
if (!response.ok) {
throw new Error(`Archive load failed: ${response.status}`);
}
......@@ -558,7 +551,7 @@ export default function App() {
if (messages.length) {
setIsArchiving(true);
try {
await fetch(`${backendUrl}/api/chat/archive`, {
await fetch(`/api/chat/archive`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
......@@ -593,7 +586,7 @@ export default function App() {
});
try {
const response = await fetch(`${backendUrl}/api/canvas/save`, {
const response = await fetch(`/api/canvas/save`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ data_url: dataUrl, filename_hint: "canvas" }),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment