diff --git a/src/components/organisms/ProxyForm.tsx b/src/components/organisms/ProxyForm.tsx index c2a17b3f..b82bb86f 100644 --- a/src/components/organisms/ProxyForm.tsx +++ b/src/components/organisms/ProxyForm.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import { styled } from '@mui/system'; -import { TextField, Button, RadioGroup, FormControlLabel, Radio, Box, Typography } from '@mui/material'; +import { TextField, Button, Switch, FormControlLabel, Box, Typography } from '@mui/material'; import { sendProxyConfig } from '../../api/proxy'; import { useGlobalInfoStore } from '../../context/globalInfo'; @@ -22,6 +22,7 @@ const ProxyForm: React.FC = () => { username: '', password: '', }); + const [requiresAuth, setRequiresAuth] = useState(false); const { notify } = useGlobalInfoStore(); @@ -30,6 +31,13 @@ const ProxyForm: React.FC = () => { setProxyConfig({ ...proxyConfig, [name]: value }); }; + const handleAuthToggle = (e: React.ChangeEvent) => { + setRequiresAuth(e.target.checked); + if (!e.target.checked) { + setProxyConfig({ ...proxyConfig, username: '', password: '' }); + } + }; + const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); await sendProxyConfig(proxyConfig).then((response) => { @@ -44,7 +52,9 @@ const ProxyForm: React.FC = () => { return (
- Proxy Configuration + + Proxy Configuration + { /> - - - - } + label="Requires Authentication?" /> + {requiresAuth && ( + <> + + + + + + + + )}