configurable url
This commit is contained in:
4
frontend/.env.development
Normal file
4
frontend/.env.development
Normal 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
4
frontend/.env.production
Normal file
@@ -0,0 +1,4 @@
|
||||
# Frontend Production Environment
|
||||
# API URL should be relative in Docker setup
|
||||
|
||||
NEXT_PUBLIC_API_URL=/api
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user