From 494ea566f26da2a6a957b3a83b2bad429108ae9b Mon Sep 17 00:00:00 2001 From: daniel-vahn Date: Wed, 31 Jul 2024 12:23:05 +0200 Subject: [PATCH] refactor: Update API endpoints in App.tsx and ConnectOverlay.tsx --- src/App.tsx | 2 +- src/components/connectOverlay/ConnectOverlay.tsx | 13 ++++++++----- vite.config.ts | 7 +++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index b92ab51..a8bfa6b 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 + '/disconnect', { + await axios.post(BRIDGE_URL + '/api/disconnect', { providerId: window.localStorage.getItem('providerId'), }); } diff --git a/src/components/connectOverlay/ConnectOverlay.tsx b/src/components/connectOverlay/ConnectOverlay.tsx index b6bd52f..1839980 100644 --- a/src/components/connectOverlay/ConnectOverlay.tsx +++ b/src/components/connectOverlay/ConnectOverlay.tsx @@ -98,9 +98,12 @@ const ConnectOverlay: React.FC = ({ window.localStorage.removeItem('walletconnect'); window.localStorage.removeItem('WALLETCONNECT_DEEPLINK_CHOICE'); - const response = await axios.post(BRIDGE_URL + '/init-provider', { - wallet: wallet, - }); + const response = await axios.post( + BRIDGE_URL + '/api/init-provider', + { + wallet: wallet, + } + ); const providerId = response.data.providerId; const uri = response.data.uri; @@ -121,7 +124,7 @@ const ConnectOverlay: React.FC = ({ try { const statusResponse = await axios.post( - BRIDGE_URL + '/is-connected', + BRIDGE_URL + '/api/is-connected', { providerId: providerId, withCredentials: true, @@ -203,7 +206,7 @@ const ConnectOverlay: React.FC = ({ window.localStorage.removeItem('WALLETCONNECT_DEEPLINK_CHOICE'); dispatch(setConnectionState('disconnected')); - await axios.post(BRIDGE_URL + '/disconnect', { + await axios.post(BRIDGE_URL + '/api/disconnect', { providerId: window.localStorage.getItem('providerId'), headers: { 'Content-Type': 'application/json', diff --git a/vite.config.ts b/vite.config.ts index 482c5cc..fe1179d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -11,5 +11,12 @@ 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/, ''), + }, + }, }, });