import axios from 'axios'; import AsyncStorage from '@react-native-async-storage/async-storage'; // Replace with your local machine's IP (for Android Emulator use 10.0.2.2) // For physical device, use your machine's LAN IP e.g., 192.168.1.X const API_URL = 'http://192.168.29.100:3000'; const api = axios.create({ baseURL: API_URL, headers: { 'Content-Type': 'application/json', }, }); api.interceptors.request.use(async (config) => { const token = await AsyncStorage.getItem('userToken'); if (token) { config.headers.Authorization = `Bearer ${token}`; } return config; }); export default api;