From 599c55bd8374f9b96052712e78201387db17e934 Mon Sep 17 00:00:00 2001 From: daniel-vahn Date: Wed, 31 Jul 2024 12:25:31 +0200 Subject: [PATCH] refactor: Update API endpoints and headers in App.tsx and ConnectOverlay.tsx --- src/App.tsx | 2 +- .../connectOverlay/ConnectOverlay.tsx | 18 ++++++++++-------- vite.config.ts | 7 ------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index a8bfa6b..b92ab51 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -189,7 +189,7 @@ function App() { setSignedMessage(null); setView(View.CONNECT); - await axios.post(BRIDGE_URL + '/api/disconnect', { + await axios.post(BRIDGE_URL + '/disconnect', { providerId: window.localStorage.getItem('providerId'), }); } diff --git a/src/components/connectOverlay/ConnectOverlay.tsx b/src/components/connectOverlay/ConnectOverlay.tsx index 1839980..4c8b965 100644 --- a/src/components/connectOverlay/ConnectOverlay.tsx +++ b/src/components/connectOverlay/ConnectOverlay.tsx @@ -98,12 +98,14 @@ const ConnectOverlay: React.FC = ({ window.localStorage.removeItem('walletconnect'); window.localStorage.removeItem('WALLETCONNECT_DEEPLINK_CHOICE'); - const response = await axios.post( - BRIDGE_URL + '/api/init-provider', - { - wallet: wallet, - } - ); + const response = await axios.post(BRIDGE_URL + '/init-provider', { + wallet: wallet, + Headers: { + 'Content-Type': 'application/json', + 'Access-Control-Allow-Origin': '*', + 'ngrok-skip-browser-warning': 'true', + }, + }); const providerId = response.data.providerId; const uri = response.data.uri; @@ -124,7 +126,7 @@ const ConnectOverlay: React.FC = ({ try { const statusResponse = await axios.post( - BRIDGE_URL + '/api/is-connected', + BRIDGE_URL + '/is-connected', { providerId: providerId, withCredentials: true, @@ -206,7 +208,7 @@ const ConnectOverlay: React.FC = ({ window.localStorage.removeItem('WALLETCONNECT_DEEPLINK_CHOICE'); dispatch(setConnectionState('disconnected')); - await axios.post(BRIDGE_URL + '/api/disconnect', { + await axios.post(BRIDGE_URL + '/disconnect', { providerId: window.localStorage.getItem('providerId'), headers: { 'Content-Type': 'application/json', diff --git a/vite.config.ts b/vite.config.ts index fe1179d..482c5cc 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -11,12 +11,5 @@ export default defineConfig({ base: './', server: { port: 5174, - proxy: { - '/api': { - target: 'https://ns3113082.ip-145-239-205.eu:3000', - changeOrigin: true, - rewrite: (path) => path.replace(/^\/api/, ''), - }, - }, }, });