- NestJS backend: auth, restaurants, orders, drivers, payments, tracking, reviews, zones, admin, email - Next.js 14 frontend: landing, restaurants, checkout, tracking, dashboards, onboarding - Expo mobile app: driver orders and earnings screens - PostgreSQL + PostGIS schema with seed data - Docker Compose for local dev (Postgres, Redis, OSRM) - MapLibre GL + OpenStreetMap integration - Stripe subscription and payment processing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
25 lines
658 B
TypeScript
25 lines
658 B
TypeScript
import axios from 'axios'
|
|
import AsyncStorage from '@react-native-async-storage/async-storage'
|
|
|
|
export const api = axios.create({
|
|
baseURL: `${process.env.EXPO_PUBLIC_API_URL}/api/v1`,
|
|
headers: { 'Content-Type': 'application/json' },
|
|
})
|
|
|
|
api.interceptors.request.use(async (config) => {
|
|
const token = await AsyncStorage.getItem('vibe_token')
|
|
if (token) config.headers.Authorization = `Bearer ${token}`
|
|
return config
|
|
})
|
|
|
|
api.interceptors.response.use(
|
|
(res) => res,
|
|
(err) => {
|
|
if (err.response?.status === 401) {
|
|
AsyncStorage.removeItem('vibe_token')
|
|
// Navigation handled at app level
|
|
}
|
|
return Promise.reject(err)
|
|
},
|
|
)
|