refactor: rename to server_url
This commit is contained in:
@@ -18,13 +18,13 @@ const FormControl = styled(Box)({
|
|||||||
|
|
||||||
const ProxyForm: React.FC = () => {
|
const ProxyForm: React.FC = () => {
|
||||||
const [proxyConfig, setProxyConfig] = useState({
|
const [proxyConfig, setProxyConfig] = useState({
|
||||||
server: '',
|
server_url: '',
|
||||||
username: '',
|
username: '',
|
||||||
password: '',
|
password: '',
|
||||||
});
|
});
|
||||||
const [requiresAuth, setRequiresAuth] = useState<boolean>(false);
|
const [requiresAuth, setRequiresAuth] = useState<boolean>(false);
|
||||||
const [errors, setErrors] = useState({
|
const [errors, setErrors] = useState({
|
||||||
server: '',
|
server_url: '',
|
||||||
username: '',
|
username: '',
|
||||||
password: '',
|
password: '',
|
||||||
});
|
});
|
||||||
@@ -33,10 +33,10 @@ const ProxyForm: React.FC = () => {
|
|||||||
|
|
||||||
const validateForm = () => {
|
const validateForm = () => {
|
||||||
let valid = true;
|
let valid = true;
|
||||||
let errorMessages = { server: '', username: '', password: '' };
|
let errorMessages = { server_url: '', username: '', password: '' };
|
||||||
|
|
||||||
if (!proxyConfig.server) {
|
if (!proxyConfig.server_url) {
|
||||||
errorMessages.server = 'Server URL is required';
|
errorMessages.server_url = 'Server URL is required';
|
||||||
valid = false;
|
valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,13 +92,13 @@ const ProxyForm: React.FC = () => {
|
|||||||
<FormControl>
|
<FormControl>
|
||||||
<TextField
|
<TextField
|
||||||
label="Proxy Server URL"
|
label="Proxy Server URL"
|
||||||
name="server"
|
name="server_url"
|
||||||
value={proxyConfig.server}
|
value={proxyConfig.server_url}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
fullWidth
|
fullWidth
|
||||||
required
|
required
|
||||||
error={!!errors.server}
|
error={!!errors.server_url}
|
||||||
helperText={errors.server || 'e.g., http://proxy-server.com:8080'}
|
helperText={errors.server_url || 'e.g., http://proxy-server.com:8080'}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
@@ -141,7 +141,7 @@ const ProxyForm: React.FC = () => {
|
|||||||
color="primary"
|
color="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
fullWidth
|
fullWidth
|
||||||
disabled={!proxyConfig.server || (requiresAuth && (!proxyConfig.username || !proxyConfig.password))}
|
disabled={!proxyConfig.server_url || (requiresAuth && (!proxyConfig.username || !proxyConfig.password))}
|
||||||
>
|
>
|
||||||
Add Proxy
|
Add Proxy
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user