From 0794dd81314624338c71e1bd9d47d8edab483b87 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 26 Oct 2024 05:32:44 +0530 Subject: [PATCH] feat: get proxy config --- src/api/proxy.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/api/proxy.ts b/src/api/proxy.ts index 9ae00c55..870c1aef 100644 --- a/src/api/proxy.ts +++ b/src/api/proxy.ts @@ -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 }; + } } \ No newline at end of file