From 1ec4a37fdea1115f2c4d824e020665f32ca614df Mon Sep 17 00:00:00 2001 From: urieljarethbusiness-cpu Date: Sun, 17 May 2026 12:13:45 -0600 Subject: [PATCH] 1 --- frontend/lib/api.ts | 3 ++- frontend/next.config.mjs | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/frontend/lib/api.ts b/frontend/lib/api.ts index f32e24c..7ba2fe6 100644 --- a/frontend/lib/api.ts +++ b/frontend/lib/api.ts @@ -1,4 +1,5 @@ -export const API_URL = process.env.NEXT_PUBLIC_API_URL ?? "http://127.0.0.1:8000"; +const configuredApiUrl = process.env.NEXT_PUBLIC_API_URL; +export const API_URL = configuredApiUrl === undefined ? "http://127.0.0.1:8000" : configuredApiUrl || "/api"; export type Subject = { id: number; name: string; slug: string; created_at: string }; export type Week = { id: number; subject_id: number; number: number; title?: string | null; created_at: string }; diff --git a/frontend/next.config.mjs b/frontend/next.config.mjs index b030fed..8b98408 100644 --- a/frontend/next.config.mjs +++ b/frontend/next.config.mjs @@ -5,12 +5,12 @@ const nextConfig = { output: "standalone", async rewrites() { return [ - { source: "/health", destination: `${backendUrl}/health` }, - { source: "/settings/:path*", destination: `${backendUrl}/settings/:path*` }, - { source: "/subjects/:path*", destination: `${backendUrl}/subjects/:path*` }, - { source: "/sources/:path*", destination: `${backendUrl}/sources/:path*` }, - { source: "/documents/:path*", destination: `${backendUrl}/documents/:path*` }, - { source: "/jobs/:path*", destination: `${backendUrl}/jobs/:path*` }, + { source: "/api/health", destination: `${backendUrl}/health` }, + { source: "/api/settings/:path*", destination: `${backendUrl}/settings/:path*` }, + { source: "/api/subjects/:path*", destination: `${backendUrl}/subjects/:path*` }, + { source: "/api/sources/:path*", destination: `${backendUrl}/sources/:path*` }, + { source: "/api/documents/:path*", destination: `${backendUrl}/documents/:path*` }, + { source: "/api/jobs/:path*", destination: `${backendUrl}/jobs/:path*` }, ]; }, };