Skip to content

Commit

Permalink
fix: getWalletServiceNetwork function
Browse files Browse the repository at this point in the history
- get the correct data
- add a strictier status validation to only consider HTTP status code 200
  • Loading branch information
alexruzenhack committed Oct 25, 2023
1 parent 42c06c7 commit 42f6305
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/sagas/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,14 @@ export async function getWalletServiceNetwork() {
try {
const timeout = WALLET_SERVICE_REQUEST_TIMEOUT;
// eslint-disable-next-line max-len
const instance = axiosWrapperCreateRequestInstance(config.getWalletServiceBaseUrl, null, timeout);
const response = await instance.get(`version`);
return response.data.network;
const instance = axiosWrapperCreateRequestInstance(config.getWalletServiceBaseUrl(), null, timeout);
const response = await instance.get(`version`, {
validateStatus: function (status) {

Check warning on line 206 in src/sagas/helpers.js

View workflow job for this annotation

GitHub Actions / test (16.x)

Unexpected unnamed method 'validateStatus'

Check failure on line 206 in src/sagas/helpers.js

View workflow job for this annotation

GitHub Actions / test (16.x)

Expected method shorthand
return status === 200; // Only 200 status is valid
}
});
// the first 'data' is from axios, the second is from payload
return response.data.data.network;
} catch {
throw new Error('Error getting wallet-service version data.');
}
Expand Down

0 comments on commit 42f6305

Please sign in to comment.