Skip to content

Commit

Permalink
More prod fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
roar-skinderviken committed Nov 23, 2024
1 parent 9bb8146 commit a014ea7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ OAUTH_CLIENT_SECRET=secret
OAUTH_BASE_URL=http://localhost:9000/auth-server
NEXTAUTH_SECRET=secret
NEXTAUTH_URL=http://localhost:3000/api/auth
USER_IMAGE_BACKEND_URL=http://localhost:8080/api/user/image
RECAPTCHA_SITE_KEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
NEXT_PUBLIC_KMEANS_BACKEND_URL=http://localhost:8000/k-means
NEXT_PUBLIC_CALCULATOR_BACKEND_URL=http://localhost:8080/api/calculator
NEXT_PUBLIC_USER_BACKEND_URL=http://localhost:8080/api/user
SPRING_BACKEND_BASE_URL=http://localhost:8080
```
Value for `RECAPTCHA_SITE_KEY` is a dev value.

Expand Down
3 changes: 2 additions & 1 deletion next-app/src/app/user/calculator/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {getServerSession} from "next-auth"
import authOptions from "@/authOptions"
import {CustomSession} from "@/types/authTypes"

const BACKEND_BASE_URL = process.env.NEXT_PUBLIC_CALCULATOR_BACKEND_URL || "/backend-spring-boot/api/calculator"
const SPRING_BACKEND_BASE_URL = process.env.SPRING_BACKEND_BASE_URL || ""
const BACKEND_BASE_URL = `${SPRING_BACKEND_BASE_URL}/api/calculator`

export async function POST(request: NextRequest) {
const session = (await getServerSession(authOptions)) as CustomSession | null
Expand Down
5 changes: 3 additions & 2 deletions next-app/src/app/user/image/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {getServerSession} from "next-auth"
import authOptions from "@/authOptions"
import {CustomSession} from "@/types/authTypes"

const BACKEND_BASE_URL = process.env.USER_IMAGE_BACKEND_URL || "/backend-spring-boot/api/user/image"
const SPRING_BACKEND_BASE_URL = process.env.SPRING_BACKEND_BASE_URL || ""
const IMAGE_BACKEND_URL = `${SPRING_BACKEND_BASE_URL}/api/user/image`

const buildResponse = (contentType: string, buffer: Buffer) => new Response(
buffer,
Expand All @@ -26,7 +27,7 @@ export async function GET() {
}

try {
const response = await fetch(`${BACKEND_BASE_URL}/${session.user?.id}`, fetchOptions)
const response = await fetch(`${IMAGE_BACKEND_URL}/${session.user?.id}`, fetchOptions)

if (!response.ok) {
console.error("Failed to fetch image from backend:", response.statusText)
Expand Down
2 changes: 2 additions & 0 deletions next-app/src/app/user/signed-out/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Hero from "@/components/Hero"
import Link from "next/link"

export const dynamic = "force-dynamic"

export const metadata = {
title: "Signed out | VICX"
}
Expand Down

0 comments on commit a014ea7

Please sign in to comment.