From e3a818680c5a2bef956690ccf12fc7b5d18d0c88 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 26 Oct 2024 05:37:21 +0530 Subject: [PATCH] feat: test proxy config --- src/components/organisms/ProxyForm.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/organisms/ProxyForm.tsx b/src/components/organisms/ProxyForm.tsx index 6b284d4d..f3fd38fd 100644 --- a/src/components/organisms/ProxyForm.tsx +++ b/src/components/organisms/ProxyForm.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import { styled } from '@mui/system'; import { TextField, Button, Switch, FormControlLabel, Box, Typography, Tabs, Tab } from '@mui/material'; -import { sendProxyConfig } from '../../api/proxy'; +import { sendProxyConfig, getProxyConfig, testProxyConfig } from '../../api/proxy'; import { useGlobalInfoStore } from '../../context/globalInfo'; const FormContainer = styled(Box)({ @@ -28,6 +28,7 @@ const ProxyForm: React.FC = () => { password: '', }); const [tabIndex, setTabIndex] = useState(0); + const [isProxyConfigured, setIsProxyConfigured] = useState(false); const { notify } = useGlobalInfoStore(); @@ -87,6 +88,17 @@ const ProxyForm: React.FC = () => { setTabIndex(newValue); }; + // test proxy config + const testProxy = async () => { + await testProxyConfig().then((response) => { + if (response.success) { + notify('success', 'Proxy configuration is working'); + } else { + notify('error', 'Failed to test proxy configuration. Try again.'); + } + }); + }; + return (