This commit is contained in:
Hymmel 2026-01-21 10:12:51 +01:00
parent aeea6bfb84
commit 12c4dd2aef
5 changed files with 14 additions and 3 deletions

4
Frontend/.env Normal file
View file

@ -0,0 +1,4 @@
NEXT_PUBLIC_API_URL="https://projektbackend.lona-development.org"
API_URL="https://projektbackend.lona-development.org"
NEXTAUTH_SECRET="fuerfortnite"
NEXTAUTH_URL="https://projekt.lona-development.org"

View file

@ -11,6 +11,10 @@ FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ARG NEXT_PUBLIC_API_URL
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
RUN npm run build
# Production image, copy all the files and run next

View file

@ -15,7 +15,7 @@ const handler = NextAuth({
if (!credentials?.email || !credentials?.password) return null
try {
const res = await fetch(`${process.env.API_URL || 'http://localhost:8080'}/api/auth/login`, {
const res = await fetch(`${process.env.API_URL}/api/auth/login`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({

View file

@ -4,7 +4,7 @@ import { createContext, useContext, useState, useCallback, useEffect, type React
import { useSession, signIn, signOut } from "next-auth/react"
import type { User, Ticket, TicketStatus, Room } from "./types"
const API_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:8080/api"
const API_URL = process.env.NEXT_PUBLIC_API_URL
interface AuthContextType {
user: User | null

View file

@ -26,7 +26,10 @@ services:
restart: unless-stopped
frontend:
build: ./Frontend
build:
context: ./Frontend
args:
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL}
container_name: ticketsystem-frontend
environment:
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://projekt.lona-development.org/api}