mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-13 19:06:26 +00:00
Merge pull request #1360 from RoboSats/fix-build-in-calls
Fix build-it in
This commit is contained in:
commit
a6573ba416
@ -1,6 +1,6 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useAutocomplete } from '@mui/base/useAutocomplete';
|
import useAutocomplete from '@mui/base/useAutocomplete';
|
||||||
import { styled } from '@mui/material/styles';
|
import { styled } from '@mui/material/styles';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
|
@ -33,6 +33,7 @@ import { TorIcon } from '../Icons';
|
|||||||
import SwapCalls from '@mui/icons-material/SwapCalls';
|
import SwapCalls from '@mui/icons-material/SwapCalls';
|
||||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||||
import { GarageContext, UseGarageStoreType } from '../../contexts/GarageContext';
|
import { GarageContext, UseGarageStoreType } from '../../contexts/GarageContext';
|
||||||
|
import { apiClient } from '../../services/api';
|
||||||
|
|
||||||
interface SettingsFormProps {
|
interface SettingsFormProps {
|
||||||
dense?: boolean;
|
dense?: boolean;
|
||||||
@ -252,6 +253,7 @@ const SettingsForm = ({ dense = false }: SettingsFormProps): JSX.Element => {
|
|||||||
onChange={(_e, useProxy) => {
|
onChange={(_e, useProxy) => {
|
||||||
setSettings({ ...settings, useProxy });
|
setSettings({ ...settings, useProxy });
|
||||||
systemClient.setItem('settings_use_proxy', String(useProxy));
|
systemClient.setItem('settings_use_proxy', String(useProxy));
|
||||||
|
apiClient.useProxy = useProxy
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ToggleButton value={true} color='primary'>
|
<ToggleButton value={true} color='primary'>
|
||||||
|
@ -55,7 +55,7 @@ class ApiNativeClient implements ApiClient {
|
|||||||
|
|
||||||
public delete: (baseUrl: string, path: string, auth?: Auth) => Promise<object | undefined> =
|
public delete: (baseUrl: string, path: string, auth?: Auth) => Promise<object | undefined> =
|
||||||
async (baseUrl, path, auth) => {
|
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({
|
return await window.NativeRobosats?.postMessage({
|
||||||
category: 'http',
|
category: 'http',
|
||||||
type: 'delete',
|
type: 'delete',
|
||||||
@ -71,7 +71,7 @@ class ApiNativeClient implements ApiClient {
|
|||||||
body: object,
|
body: object,
|
||||||
auth?: Auth,
|
auth?: Auth,
|
||||||
) => Promise<object | undefined> = async (baseUrl, path, body, auth) => {
|
) => Promise<object | undefined> = 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({
|
return await window.NativeRobosats?.postMessage({
|
||||||
category: 'http',
|
category: 'http',
|
||||||
type: 'post',
|
type: 'post',
|
||||||
@ -87,7 +87,7 @@ class ApiNativeClient implements ApiClient {
|
|||||||
path,
|
path,
|
||||||
auth,
|
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({
|
return await window.NativeRobosats?.postMessage({
|
||||||
category: 'http',
|
category: 'http',
|
||||||
type: 'get',
|
type: 'get',
|
||||||
|
Loading…
Reference in New Issue
Block a user