Skip to content

Commit

Permalink
refactor: Update API endpoints and headers in App.tsx and ConnectOver…
Browse files Browse the repository at this point in the history
…lay.tsx
  • Loading branch information
daniel-vahn committed Jul 31, 2024
1 parent 494ea56 commit 599c55b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 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 + '/api/disconnect', {
await axios.post(BRIDGE_URL + '/disconnect', {
providerId: window.localStorage.getItem('providerId'),
});
}
Expand Down
18 changes: 10 additions & 8 deletions src/components/connectOverlay/ConnectOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,14 @@ const ConnectOverlay: React.FC<Props> = ({
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;

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

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

0 comments on commit 599c55b

Please sign in to comment.