feat: get proxy config

This commit is contained in:
karishmas6
2024-10-26 05:32:44 +05:30
parent caddee6074
commit 0794dd8131

View File

@@ -12,4 +12,18 @@ export const sendProxyConfig = async (proxyConfig: { server_url: string, usernam
console.log(error);
return false;
}
}
export const getProxyConfig = async (): Promise<{ proxy_url: string, auth: boolean }> => {
try {
const response = await axios.get(`http://localhost:8080/proxy/config`);
if (response.status === 200) {
return response.data;
} else {
throw new Error(`Failed to fetch proxy configuration. Try again.`);
}
} catch (error: any) {
console.log(error);
return { proxy_url: '', auth: false };
}
}