Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 11x 4x 4x 11x 11x 11x 11x 11x | import { getAuth, getIdToken } from '@react-native-firebase/auth';
import { HttpClientLive, HttpService } from '@repo/services/httpClients';
import {
BASE_URL_API,
BASIC_AUTH_PASSWORD,
BASIC_AUTH_USERNAME,
E2E_SERVER_URL,
SPACE_URL_API,
} from '@/constants/apis';
export const getAccessToken = async () => {
const user = getAuth().currentUser;
return user ? await getIdToken(user) : null;
};
// --- Legacy Promise-based instances ---
export const https = new HttpService(BASE_URL_API || '', {
getToken: getAccessToken,
auth: { type: 'bearer' },
});
export const spaceHttps = new HttpService(SPACE_URL_API || '', {
getToken: getAccessToken,
auth: { type: 'bearer' },
});
export const basicAuthHttps = new HttpService(BASE_URL_API || '', {
auth: {
type: 'basic',
basic: {
username: BASIC_AUTH_USERNAME || '',
password: BASIC_AUTH_PASSWORD || '',
},
},
});
export const e2eHttps = new HttpService(E2E_SERVER_URL);
// --- Effect Layers ---
export const MainHttpClient = HttpClientLive(BASE_URL_API || '', {
getToken: getAccessToken,
auth: { type: 'bearer' },
});
|