From 7331d0cfd96d9f9d690eef86d948a8bf4ce31b6f Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 26 Oct 2024 05:34:19 +0530 Subject: [PATCH] feat: test 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 870c1aef..04508101 100644 --- a/src/api/proxy.ts +++ b/src/api/proxy.ts @@ -26,4 +26,18 @@ export const getProxyConfig = async (): Promise<{ proxy_url: string, auth: boole console.log(error); return { proxy_url: '', auth: false }; } +} + +export const testProxyConfig = async (): Promise<{ success: boolean}> => { + try { + const response = await axios.get(`http://localhost:8080/proxy/test`); + if (response.status === 200) { + return response.data; + } else { + throw new Error(`Failed to test proxy configuration. Try again.`); + } + } catch (error: any) { + console.log(error); + return { success: false }; + } } \ No newline at end of file