Files
fiberops-mobile/services/api.ts
Nemo 4644a3194d feat: major UI/UX overhaul + user management + ticket detail refactor
- 5-tab navigation (Home/Clients/Collect/Tickets/Profile)
- Inline styles throughout (17px min font, SafeAreaView)
- Dashboard fixed to match real API shape
- Ticket detail: 2 tabs (Details + Comments), always-visible comment input
- Installation confirmation: GPS coordinate capture + client location update
- User management screens (Admin only): list, create, detail + role/active toggle
- Tasks folder replaces tickets folder
- Remittance detail: inline styles
- Record payment: prefill from client, live button text
- Icon component with SVG icons
- Color system: primary #0891B2
2026-03-24 10:37:57 +08:00

33 lines
784 B
TypeScript

import axios from 'axios';
import * as SecureStore from 'expo-secure-store';
import { API_URL, STORAGE_KEYS } from '../constants';
export const api = axios.create({
baseURL: API_URL,
timeout: 15000,
headers: {
'Content-Type': 'application/json',
},
});
api.interceptors.request.use(async (config) => {
const token = await SecureStore.getItemAsync('fiberops_token');
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
return config;
});
api.interceptors.response.use(
(response) => response,
async (error) => {
if (error.response?.status === 401) {
await SecureStore.deleteItemAsync('fiberops_token');
await SecureStore.deleteItemAsync('fiberops_tenant');
}
return Promise.reject(error);
}
);
export default api;