feat: tambah error logger ke monitoring dashboard dengan offline queue

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-21 15:25:10 +08:00
parent b7165c5990
commit 6021d17b5a
6 changed files with 132 additions and 1 deletions

View File

@@ -1,10 +1,22 @@
import axios from 'axios';
import axios, { AxiosError } from 'axios';
import Constants from 'expo-constants';
import { logError } from '@/lib/errorLogger';
const api = axios.create({
baseURL: Constants?.expoConfig?.extra?.URL_API
});
api.interceptors.response.use(
(response) => response,
(error: AxiosError) => {
const status = error.response?.status;
const url = error.config?.url ?? 'unknown endpoint';
const description = `API error ${status ?? 'network'} on ${url}`;
logError(description, error);
return Promise.reject(error);
}
);
export const apiCheckPhoneLogin = async (body: { phone: string }) => {
const response = await api.post('/auth/login', body)
return response.data;