import React, { useState } from 'react'; import { TextField, Button, RadioGroup, FormControlLabel, Radio, Box, Typography } from '@mui/material'; import { styled } from '@mui/system'; import axios from 'axios'; const FormContainer = styled(Box)({ display: 'flex', flexDirection: 'column', gap: '16px', padding: '20px', borderRadius: '8px', }); const FormControl = styled(Box)({ marginBottom: '16px', }); const ProxyForm: React.FC = () => { const [proxyConfig, setProxyConfig] = useState({ type: 'http', server: '', username: '', password: '', }); const handleChange = (e: React.ChangeEvent) => { const { name, value } = e.target; setProxyConfig({ ...proxyConfig, [name]: value }); }; const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); try { const response = await axios.post('http://localhost:8080/proxy/config', proxyConfig); if (response.status === 200) { return response.data; } else { throw new Error(`Failed to submit proxy configuration. Try again.`); } } catch (error) { alert('Error submitting proxy configuration'); } }; return (
Select Proxy Type } label="HTTP" /> } label="HTTPS" /> } label="SOCKS5" /> Proxy Configuration
); }; export default ProxyForm;