Skip to content

Commit

Permalink
[tickets] Filter vsp by network (#2830)
Browse files Browse the repository at this point in the history
  • Loading branch information
vctt94 authored Oct 29, 2020
1 parent 9011e86 commit a4dec62
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/actions/VSPActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,9 @@ export const DISCOVERAVAILABLEVSPS_ATTEMPT = "DISCOVERAVAILABLEVSPS_ATTEMPT";
export const DISCOVERAVAILABLEVSPS_SUCCESS = "DISCOVERAVAILABLEVSPS_SUCCESS";
export const DISCOVERAVAILABLEVSPS_FAILED = "DISCOVERAVAILABLEVSPS_FAILED";

export const discoverAvailableVSPs = () => async (dispatch) => {
export const discoverAvailableVSPs = () => async (dispatch, getState) => {
dispatch({ type: DISCOVERAVAILABLEVSPS_ATTEMPT });
const isTestnet = sel.isTestNet(getState());
try {
let availableVSPs = await wallet.getAllVSPs();
// add label and value so we can show this values on a select input.
Expand All @@ -363,7 +364,12 @@ export const discoverAvailableVSPs = () => async (dispatch) => {
label: vsp.host,
value: vsp.host
})
);
).filter(({ vspData }) => {
if(!vspData) return false;
const vspTestnet = vspData.network === TESTNET;
return vspTestnet === isTestnet;
});

dispatch({
type: DISCOVERAVAILABLEVSPS_SUCCESS,
availableVSPs
Expand Down

0 comments on commit a4dec62

Please sign in to comment.