diff --git a/frontend/src/components/SettingsForm/index.tsx b/frontend/src/components/SettingsForm/index.tsx index 90f96981f..0c81dbe1b 100644 --- a/frontend/src/components/SettingsForm/index.tsx +++ b/frontend/src/components/SettingsForm/index.tsx @@ -33,6 +33,7 @@ import { TorIcon } from '../Icons'; import SwapCalls from '@mui/icons-material/SwapCalls'; import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext'; import { GarageContext, UseGarageStoreType } from '../../contexts/GarageContext'; +import { apiClient } from '../../services/api'; interface SettingsFormProps { dense?: boolean; @@ -252,6 +253,7 @@ const SettingsForm = ({ dense = false }: SettingsFormProps): JSX.Element => { onChange={(_e, useProxy) => { setSettings({ ...settings, useProxy }); systemClient.setItem('settings_use_proxy', String(useProxy)); + apiClient.useProxy = useProxy }} > diff --git a/frontend/src/services/api/ApiNativeClient/index.ts b/frontend/src/services/api/ApiNativeClient/index.ts index 93f8ba396..afc1b51ac 100644 --- a/frontend/src/services/api/ApiNativeClient/index.ts +++ b/frontend/src/services/api/ApiNativeClient/index.ts @@ -55,7 +55,7 @@ class ApiNativeClient implements ApiClient { public delete: (baseUrl: string, path: string, auth?: Auth) => Promise = async (baseUrl, path, auth) => { - if (!this.proxy) this.webClient.delete(baseUrl, path, auth); + if (!this.useProxy) return this.webClient.delete(baseUrl, path, auth); return await window.NativeRobosats?.postMessage({ category: 'http', type: 'delete', @@ -71,7 +71,7 @@ class ApiNativeClient implements ApiClient { body: object, auth?: Auth, ) => Promise = async (baseUrl, path, body, auth) => { - if (!this.proxy) this.webClient.post(baseUrl, path, body, auth); + if (!this.useProxy) return this.webClient.post(baseUrl, path, body, auth); return await window.NativeRobosats?.postMessage({ category: 'http', type: 'post', @@ -87,7 +87,7 @@ class ApiNativeClient implements ApiClient { path, auth, ) => { - if (!this.proxy) this.webClient.get(baseUrl, path, auth); + if (!this.useProxy) return this.webClient.get(baseUrl, path, auth); return await window.NativeRobosats?.postMessage({ category: 'http', type: 'get',