React Native mobile application for SAPIENS news platform. Consolidated all previous history into single commit. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
// API Configuration
|
|
// For development with Expo, we need to use the computer's local IP address
|
|
// You can find your IP by running: ifconfig | grep "inet " | grep -v 127.0.0.1
|
|
|
|
// TODO: Replace with your computer's IP address when testing on physical device
|
|
// For iOS Simulator: use 'localhost'
|
|
// For Android Emulator: use '10.0.2.2'
|
|
// For physical device: use your computer's local IP (e.g., '192.168.1.100')
|
|
|
|
import Constants from 'expo-constants';
|
|
import { Platform } from 'react-native';
|
|
|
|
// Get the API URL based on the platform
|
|
function getApiUrl() {
|
|
if (__DEV__) {
|
|
// Development mode
|
|
if (Platform.OS === 'android') {
|
|
// Android emulator uses 10.0.2.2 to access localhost on the host
|
|
return 'http://10.0.2.2:8050';
|
|
}
|
|
|
|
// iOS simulator and web can use localhost
|
|
// For physical device, replace 'localhost' with your computer's IP
|
|
return 'http://localhost:8050';
|
|
}
|
|
|
|
// Production mode - use your production API URL
|
|
return 'https://your-production-api.com';
|
|
}
|
|
|
|
export const API_BASE_URL = getApiUrl();
|
|
export const API_TIMEOUT = 10000; // 10 seconds
|