axios+telemetry cleanup

This commit is contained in:
2026-04-02 15:19:11 +03:00
parent a3cbca1e11
commit 7e1eac8002
100 changed files with 3048 additions and 4491 deletions

View File

@@ -1,4 +1,3 @@
import axios from 'axios'
import { getOauthConfig } from '../../constants/oauth.js'
import {
getOauthAccountInfo,
@@ -7,6 +6,7 @@ import {
} from '../../utils/auth.js'
import { getGlobalConfig, saveGlobalConfig } from '../../utils/config.js'
import { logForDebugging } from '../../utils/debug.js'
import { nativeRequest } from '../../utils/http.js'
import { logError } from '../../utils/log.js'
import { isEssentialTrafficOnly } from '../../utils/privacyLevel.js'
import { getOAuthHeaders, prepareApiRequest } from '../../utils/teleport/api.js'
@@ -35,9 +35,12 @@ export async function fetchReferralEligibility(
const url = `${getOauthConfig().BASE_API_URL}/api/oauth/organizations/${orgUUID}/referral/eligibility`
const response = await axios.get(url, {
const queryParams = new URLSearchParams({ campaign }).toString()
const fullUrl = `${url}${queryParams ? `?${queryParams}` : ''}`
const response = await nativeRequest<ReferralEligibilityResponse>(fullUrl, {
method: 'GET',
headers,
params: { campaign },
timeout: 5000, // 5 second timeout for background fetch
})
@@ -56,9 +59,12 @@ export async function fetchReferralRedemptions(
const url = `${getOauthConfig().BASE_API_URL}/api/oauth/organizations/${orgUUID}/referral/redemptions`
const response = await axios.get<ReferralRedemptionsResponse>(url, {
const queryParams = new URLSearchParams({ campaign }).toString()
const fullUrl = `${url}${queryParams ? `?${queryParams}` : ''}`
const response = await nativeRequest<ReferralRedemptionsResponse>(fullUrl, {
method: 'GET',
headers,
params: { campaign },
timeout: 10000, // 10 second timeout
})