Files
FarmaFinder/apps/frontend-mobile/constants/config.ts
T
Antoni Nuñez Romeu 2843b61f82
Run Tests on Branches / Backend Tests (push) Successful in 1m56s
Run Tests on Branches / Frontend Tests (push) Successful in 1m54s
fix: resolve 6 frontend-mobile build and runtime issues
- Add missing User type fields (first_name, last_name, email, avatar_url,
  city, address) used in profile.tsx
- Fix expo-constants import to use namespace import (consistent with
  rest of codebase)
- Replace placeholder production API URL with configurable value
- Fix avatar preset/color selection passing require() IDs to Image uri
  by tracking local source separately
- Replace all relative fetch() calls with configured axios instance
  (relative URLs don't resolve in React Native)
2026-07-07 16:07:15 +02:00

20 lines
605 B
TypeScript

import * as Constants from 'expo-constants';
const ENV = {
development: {
API_BASE_URL: 'http://localhost:3001/api',
},
production: {
API_BASE_URL: Constants.expoConfig?.extra?.apiUrl || 'https://api.farmafinder.com/api',
},
};
const environment = Constants.expoConfig?.extra?.environment || (__DEV__ ? 'development' : 'production');
export const config = {
API_BASE_URL: ENV[environment as keyof typeof ENV]?.API_BASE_URL || ENV.development.API_BASE_URL,
SEARCH_DEBOUNCE_MS: 300,
CACHE_STALE_TIME: 5 * 60 * 1000, // 5 minutes
CACHE_CACHE_TIME: 30 * 60 * 1000, // 30 minutes
};