Fix new Frontend 4
This commit is contained in:
@@ -25,17 +25,18 @@ export interface ServiceEndpoints {
|
||||
|
||||
// Environment-based configuration
|
||||
const getEnvironmentConfig = (): ApiConfig => {
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
const isDevelopment = process.env.NODE_ENV === 'development';
|
||||
// Use import.meta.env instead of process.env for Vite
|
||||
const isDevelopment = import.meta.env.DEV;
|
||||
const isProduction = import.meta.env.PROD;
|
||||
|
||||
return {
|
||||
baseURL: process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000/api/v1',
|
||||
timeout: parseInt(process.env.NEXT_PUBLIC_API_TIMEOUT || '30000'),
|
||||
retries: parseInt(process.env.NEXT_PUBLIC_API_RETRIES || '3'),
|
||||
retryDelay: parseInt(process.env.NEXT_PUBLIC_API_RETRY_DELAY || '1000'),
|
||||
enableLogging: isDevelopment || process.env.NEXT_PUBLIC_API_LOGGING === 'true',
|
||||
enableCaching: process.env.NEXT_PUBLIC_API_CACHING !== 'false',
|
||||
cacheTimeout: parseInt(process.env.NEXT_PUBLIC_API_CACHE_TIMEOUT || '300000'), // 5 minutes
|
||||
baseURL: import.meta.env.VITE_API_URL || 'http://localhost:8000/api/v1',
|
||||
timeout: parseInt(import.meta.env.VITE_API_TIMEOUT || '30000'),
|
||||
retries: parseInt(import.meta.env.VITE_API_RETRIES || '3'),
|
||||
retryDelay: parseInt(import.meta.env.VITE_API_RETRY_DELAY || '1000'),
|
||||
enableLogging: isDevelopment || import.meta.env.VITE_API_LOGGING === 'true',
|
||||
enableCaching: import.meta.env.VITE_API_CACHING !== 'false',
|
||||
cacheTimeout: parseInt(import.meta.env.VITE_API_CACHE_TIMEOUT || '300000'), // 5 minutes
|
||||
};
|
||||
};
|
||||
|
||||
@@ -124,7 +125,6 @@ export const ApiVersion = {
|
||||
CURRENT: 'v1',
|
||||
} as const;
|
||||
|
||||
// Feature flags for API behavior
|
||||
export interface FeatureFlags {
|
||||
enableWebSockets: boolean;
|
||||
enableOfflineMode: boolean;
|
||||
@@ -134,9 +134,9 @@ export interface FeatureFlags {
|
||||
}
|
||||
|
||||
export const featureFlags: FeatureFlags = {
|
||||
enableWebSockets: process.env.NEXT_PUBLIC_ENABLE_WEBSOCKETS === 'true',
|
||||
enableOfflineMode: process.env.NEXT_PUBLIC_ENABLE_OFFLINE === 'true',
|
||||
enableOptimisticUpdates: process.env.NEXT_PUBLIC_ENABLE_OPTIMISTIC_UPDATES !== 'false',
|
||||
enableRequestDeduplication: process.env.NEXT_PUBLIC_ENABLE_DEDUPLICATION !== 'false',
|
||||
enableMetrics: process.env.NEXT_PUBLIC_ENABLE_METRICS === 'true',
|
||||
enableWebSockets: import.meta.env.VITE_ENABLE_WEBSOCKETS === 'true',
|
||||
enableOfflineMode: import.meta.env.VITE_ENABLE_OFFLINE === 'true',
|
||||
enableOptimisticUpdates: import.meta.env.VITE_ENABLE_OPTIMISTIC_UPDATES !== 'false',
|
||||
enableRequestDeduplication: import.meta.env.VITE_ENABLE_DEDUPLICATION !== 'false',
|
||||
enableMetrics: import.meta.env.VITE_ENABLE_METRICS === 'true',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user