axios+telemetry cleanup
This commit is contained in:
@@ -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
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user