configurable url

This commit is contained in:
Stefan Hardegger
2025-07-24 08:03:56 +02:00
parent 4bbc14d165
commit 77ad643eac
15 changed files with 257 additions and 26 deletions

View File

@@ -0,0 +1,4 @@
# Frontend Development Environment
# For local development outside of Docker
NEXT_PUBLIC_API_URL=http://localhost:8080/api

4
frontend/.env.production Normal file
View File

@@ -0,0 +1,4 @@
# Frontend Production Environment
# API URL should be relative in Docker setup
NEXT_PUBLIC_API_URL=/api

View File

@@ -2,6 +2,7 @@
import { createContext, useContext, useEffect, useState } from 'react';
import { authApi } from '../lib/api';
import { preloadSanitizationConfig } from '../lib/sanitization';
interface AuthContextType {
isAuthenticated: boolean;
@@ -30,7 +31,17 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
}
};
// Preload sanitization config for content formatting
const loadSanitizationConfig = async () => {
try {
await preloadSanitizationConfig();
} catch (error) {
console.error('Failed to preload sanitization config:', error);
}
};
checkAuth();
loadSanitizationConfig();
}, []);
const login = async (password: string) => {