Fix runtime error

This commit is contained in:
Koncept Kit
2025-12-20 18:46:07 +07:00
parent 4093c1603e
commit 33fc3a101d
3 changed files with 21 additions and 2 deletions

17
.env.example Normal file
View File

@@ -0,0 +1,17 @@
# Server Configuration
PORT=3000
WDS_SOCKET_PORT=443
# Backend API URL
REACT_APP_BACKEND_URL=http://localhost:8000
# App Base Path Configuration
# Examples:
# - For root path: REACT_APP_BASENAME=
# - For subpath: REACT_APP_BASENAME=/membership
# - For production: REACT_APP_BASENAME=/membership
REACT_APP_BASENAME=
# Feature Flags
REACT_APP_ENABLE_VISUAL_EDITS=false
ENABLE_HEALTH_CHECK=false

1
.gitignore vendored
View File

@@ -2,6 +2,7 @@
# Environment
.env
.env.production
# dependencies
/node_modules

View File

@@ -70,8 +70,9 @@ const PrivateRoute = ({ children, adminOnly = false }) => {
};
function App() {
// Use /membership basename only in production
const basename = process.env.NODE_ENV === 'production' ? '/membership' : '';
// Read basename from environment variable (defaults to empty string for root path)
// Set REACT_APP_BASENAME in .env to use a subpath (e.g., "/membership")
const basename = process.env.REACT_APP_BASENAME || '';
return (
<AuthProvider>