Skip to content

Commit

Permalink
refactor: Update API endpoints in App.tsx and ConnectOverlay.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-vahn committed Jul 31, 2024
1 parent 3da5c27 commit 494ea56
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
});
}
Expand Down
13 changes: 8 additions & 5 deletions src/components/connectOverlay/ConnectOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,12 @@ const ConnectOverlay: React.FC<Props> = ({
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;

Expand All @@ -121,7 +124,7 @@ const ConnectOverlay: React.FC<Props> = ({

try {
const statusResponse = await axios.post(
BRIDGE_URL + '/is-connected',
BRIDGE_URL + '/api/is-connected',
{
providerId: providerId,
withCredentials: true,
Expand Down Expand Up @@ -203,7 +206,7 @@ const ConnectOverlay: React.FC<Props> = ({
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',
Expand Down
7 changes: 7 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/, ''),
},
},
},
});

0 comments on commit 494ea56

Please sign in to comment.