From 75c4f90db3187ed6a8cb14a41c091982b0fa0d13 Mon Sep 17 00:00:00 2001 From: Keith Stevens Date: Sat, 28 Jan 2023 17:58:52 +0900 Subject: [PATCH] Reverting some uneccesary changes --- docker-compose.yaml | 2 +- scripts/backend-development/run-local.sh | 1 - website/src/pages/api/auth/[...nextauth].ts | 4 ++++ website/src/pages/dashboard.tsx | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 60048763..908457cd 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,7 +4,7 @@ services: # Use `docker compose up backend-dev --build --attach-dependencies` to start a database and work and the backend. backend-dev: image: sverrirab/sleep - depends_on: [db, adminer, redis, redis-insights, webdb, maildev] + depends_on: [db, adminer, redis, redis-insights] # Use `docker compose up frontend-dev --build --attach-dependencies` to start all services needed to work on the frontend. frontend-dev: diff --git a/scripts/backend-development/run-local.sh b/scripts/backend-development/run-local.sh index f81362dd..7366cde6 100755 --- a/scripts/backend-development/run-local.sh +++ b/scripts/backend-development/run-local.sh @@ -8,7 +8,6 @@ export DEBUG_USE_SEED_DATA=True export DEBUG_SKIP_TOXICITY_CALCULATION=True export DEBUG_ALLOW_SELF_LABELING=True export DEBUG_SKIP_EMBEDDING_COMPUTATION=True -export BACKEND_CORS_ORIGINS='["http://localhost:3000"]' uvicorn main:app --reload --port 8080 --host 0.0.0.0 diff --git a/website/src/pages/api/auth/[...nextauth].ts b/website/src/pages/api/auth/[...nextauth].ts index af2cbd59..7a5ddbe4 100644 --- a/website/src/pages/api/auth/[...nextauth].ts +++ b/website/src/pages/api/auth/[...nextauth].ts @@ -148,6 +148,9 @@ export const authOptions: AuthOptions = { } }, }, + /* + * We maybe need this, we maybe don't. Checking in this uncommented until + * it's confirmed we can drop this. cookies: { sessionToken: { name: `next-auth.session-token`, @@ -159,6 +162,7 @@ export const authOptions: AuthOptions = { }, }, }, + */ session: { strategy: "jwt", }, diff --git a/website/src/pages/dashboard.tsx b/website/src/pages/dashboard.tsx index 2739821b..8b9e3cae 100644 --- a/website/src/pages/dashboard.tsx +++ b/website/src/pages/dashboard.tsx @@ -11,7 +11,8 @@ import useSWR from "swr"; import useSWRImmutable from "swr/immutable"; const Dashboard = () => { - useSWR("http://localhost:8080/api/v1/auth/check", get); + // Adding a demonstrative call to the backend that includes the web's JWT. + useSWR(`${process.env.BACKEND_URL}/api/v1/auth/check`, get); const { data } = useSWRImmutable("/api/available_tasks", get);