feat: use sendProxyConfig()
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
import React, { useState } from 'react';
|
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';
|
import axios from 'axios';
|
||||||
|
import { styled } from '@mui/system';
|
||||||
|
import { TextField, Button, RadioGroup, FormControlLabel, Radio, Box, Typography } from '@mui/material';
|
||||||
|
import { sendProxyConfig } from '../../api/proxy';
|
||||||
|
|
||||||
const FormContainer = styled(Box)({
|
const FormContainer = styled(Box)({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@@ -30,16 +31,13 @@ const ProxyForm: React.FC = () => {
|
|||||||
|
|
||||||
const handleSubmit = async (e: React.FormEvent) => {
|
const handleSubmit = async (e: React.FormEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
try {
|
await sendProxyConfig(proxyConfig).then((response) => {
|
||||||
const response = await axios.post('http://localhost:8080/proxy/config', proxyConfig);
|
if (response) {
|
||||||
if (response.status === 200) {
|
alert('Proxy configuration submitted successfully');
|
||||||
return response.data;
|
} else {
|
||||||
} else {
|
alert('Failed to submit proxy configuration. Try again.');
|
||||||
throw new Error(`Failed to submit proxy configuration. Try again.`);
|
}
|
||||||
}
|
});
|
||||||
} catch (error) {
|
|
||||||
alert('Error submitting proxy configuration');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user