From 8bea06be5e5f4da219a659684e70f0f0eb88c07d Mon Sep 17 00:00:00 2001 From: Jeet Debnath Date: Mon, 16 Mar 2026 10:56:52 +0530 Subject: [PATCH] small changes --- .gitignore | 1 + backend/__pycache__/main.cpython-312.pyc | Bin 2409 -> 2581 bytes backend/main.py | 11 +++++++++-- backend/requirements.txt | 1 - src/lib/api.ts | 2 +- src/pages/HistoryPage.tsx | 4 ++-- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 7c3d27f..a3427bf 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ dist dist-ssr *.local .env +.env.* .env.local # Editor directories and files diff --git a/backend/__pycache__/main.cpython-312.pyc b/backend/__pycache__/main.cpython-312.pyc index ff90522dd9d1f4bff2a258c62133fc1d47345ccd..bbd86dd9204afbc6f88a43cd0b741970f09cb825 100644 GIT binary patch delta 796 zcmah{KX21O6u-02PDE_#T->;66BmRM68@G*fIu{2MEw9rWT_B$n3&YAE^gFLVc-L_ zSV)MmtII->U}a_@EV29vU?M`D5CeCGqJ|jphNpM${eJiUe!8Jz9$z2%1Ul9l>b}vt(s6tIL z!?DIL9FV*N_i&^fqg+X$=x%e`OA5r~?Ab{E4_ixR7m4Kz{-$3|Ni%oU5h*6cVB|XUz+NWKAeT{m-{wC@}SP#D{wj#E*6k>II@jSQKp}HWfJXZ-~z8^3#;v3<6 zb!Dz0C+Lyi3lg;Mvmj9!|MEU*oDP>V{p+G6hK14vS9{2OFQ6V--C*5Bd*HL)s?R!3 z$LleED^2rCAy98IL_{1Fajb-!<4&Mmg%P8s(XEgtrkeA;EKtydI_eCxbKUB?FJL2mmIWk8TB>qT8bOgC4(HhzRD zNV73>-Df-`*bNW+5vJw6%^8QZIgDzlTI%6i*-#!{NfqOay&Fsi7DU#tYr)HDxl8`* zauSUT=MrvN6`mJx+0KS`X5C?6RaUl6j@WU<7;wqHby{)BiNz~!kc-3~7-{<=RE@~@ z;#4|SID0L;6qK!a-aZV^W#u3E*XujHd1S#^nQile$jarO=IqCCF^kCyqR)u72>n#B fR={sD-KASCEp|Ekp(3n(p%7L+qBacP5jp!06NzOo diff --git a/backend/main.py b/backend/main.py index 24cdb1d..438c0ce 100644 --- a/backend/main.py +++ b/backend/main.py @@ -24,10 +24,17 @@ app = FastAPI( ) # CORS middleware (MUST be before routes) +cors_origins = [settings.frontend_url] +if settings.environment == "development": + cors_origins.extend([ + "http://localhost:8000", + "http://127.0.0.1:8000", + "http://localhost:5173", + ]) + app.add_middleware( CORSMiddleware, - allow_origins=["http://localhost:8000", - "http://127.0.0.1:8000", "http://localhost:5173"], + allow_origins=cors_origins, allow_credentials=True, allow_methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"], allow_headers=["*"], diff --git a/backend/requirements.txt b/backend/requirements.txt index 332067e..efd5ae2 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -5,4 +5,3 @@ pydantic==2.5.0 python-dotenv==1.0.0 pydantic-settings==2.1.0 python-multipart==0.0.6 -cors==1.0.1 diff --git a/src/lib/api.ts b/src/lib/api.ts index 16b096a..66f6694 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -3,7 +3,7 @@ * Handles all communication with the backend API */ -const API_BASE_URL = 'http://localhost:8001' +const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:8001' type ApiOptions = { method?: 'GET' | 'POST' | 'PUT' | 'DELETE' diff --git a/src/pages/HistoryPage.tsx b/src/pages/HistoryPage.tsx index c9c4a55..e676ac2 100644 --- a/src/pages/HistoryPage.tsx +++ b/src/pages/HistoryPage.tsx @@ -180,12 +180,12 @@ export default function HistoryPage() {

History

Your past reflections

- + */}