meti-frontend/lib/config.ts

36 lines
1.3 KiB
TypeScript
Raw Normal View History

2025-08-15 23:03:15 +07:00
// API Configuration
// You can modify these values directly here if environment variables are not working
2025-08-15 23:16:19 +07:00
const BACKEND_URL = 'https://evoting-be.apskel.org' // Change this to your backend URL
2025-08-15 23:03:15 +07:00
const AUTH_HEADER = '' // Change this to your actual auth header
export const API_CONFIG = {
BASE_URL: process.env.NEXT_PUBLIC_API_BASE_URL || BACKEND_URL,
AUTH_HEADER: process.env.NEXT_PUBLIC_API_AUTH_HEADER || AUTH_HEADER,
ENDPOINTS: {
LOGIN: '/api/v1/auth/login',
LOGOUT: '/api/v1/auth/logout',
VERIFY: '/api/v1/auth/verify',
VOTE_EVENTS: '/api/v1/vote-events',
CANDIDATES: '/api/v1/candidates',
VOTES: '/api/v1/votes',
FILES: '/api/v1/files/documents',
RESULTS: '/api/v1/vote-events',
}
}
// Application Configuration
export const APP_CONFIG = {
BASE_URL: process.env.NEXT_PUBLIC_BASE_URL || 'http://localhost:3000',
JWT_SECRET: process.env.JWT_SECRET || 'your-secret-key-change-this',
NODE_ENV: process.env.NODE_ENV || 'development',
}
// Debug logging
console.log('🚀 API Config loaded:', {
BASE_URL: API_CONFIG.BASE_URL,
AUTH_HEADER: API_CONFIG.AUTH_HEADER ? '*** SET ***' : '❌ NOT SET',
ENDPOINTS: API_CONFIG.ENDPOINTS,
FULL_LOGIN_URL: `${API_CONFIG.BASE_URL}${API_CONFIG.ENDPOINTS.LOGIN}`,
FULL_VOTE_EVENTS_URL: `${API_CONFIG.BASE_URL}${API_CONFIG.ENDPOINTS.VOTE_EVENTS}`,
})