File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,12 +96,12 @@ export const convertCurrencies = conversionValues => async dispatch => {
9696 const fromAmount = conversionValues . fromAmount ? conversionValues . fromAmount : '0' ;
9797 const fromCurrency = conversionValues . fromCurrency ? conversionValues . fromCurrency : 'usd' ;
9898 const toCurrency = conversionValues . toCurrency ? conversionValues . toCurrency : 'eth' ;
99- const apiRequestUrl = `https://openexchangerates.org /api/convert/ ${ fromAmount } / ${ fromCurrency } / ${ toCurrency } ?app_id=d34199d67d85445a846040c0cf621510 ` ;
99+ const apiRequestUrl = `https://api.binance.com /api/v3/avgPrice?symbol= ${ fromCurrency } ${ toCurrency } ` ;
100100
101101 try {
102102 const data = await dispatch ( apiGet ( apiRequestUrl ) ) ;
103- dispatch ( { type : CONVERT_CURRENCIES , payload : data . response } ) ;
104- return data . response ;
103+ dispatch ( { type : CONVERT_CURRENCIES , payload : data . price * fromAmount } ) ;
104+ return data . price * fromAmount ;
105105 } catch ( err ) {
106106 console . log ( 'Error in convertCurrencies' , err ) ;
107107 }
You can’t perform that action at this time.
0 commit comments