Files
parcer/src/api/proxy.ts

15 lines
534 B
TypeScript
Raw Normal View History

2024-09-30 23:53:35 +05:30
import { default as axios } from "axios";
2024-09-30 23:55:12 +05:30
export const sendProxyConfig = async (proxyConfig: {type: string, server: string, username:string, password: string}): Promise<boolean> => {
2024-09-30 23:53:35 +05:30
try {
2024-09-30 23:54:20 +05:30
const response = await axios.post(`http://localhost:8080/proxy/config`, proxyConfig);
2024-09-30 23:53:35 +05:30
if (response.status === 200) {
return response.data;
} else {
throw new Error(`Failed to submit proxy configuration. Try again.`);
}
} catch(error: any) {
console.log(error);
return false;
}
}